Posts

Showing posts from March, 2020

50 faq

Question 1- Write a program to check the given number is prime or not? import java.util.*; class PrimeTest {                 public static void main(String args[])                 {                                 System.out.print("Enter The Number: ");                                 Scanner sc=new Scanner(System.in);                             ...

Patterns Problems

Question 1- Write a program to print following pattern – Enter the number of lines you want: 5 1 22 333 4444 55555 import java.util.*; class pattern { public static void main(String args[]) {     System.out.print("Enter the number of lines you want: ");     Scanner sc=new Scanner(System.in);     int n=sc.nextInt();     for(int i=1;i<=n;i++)     {         for(int j=1;j<=i;j++)         {             System.out.print(i);         }         System.out.println();     } } } Question 2-   Write a program to print following pattern – Enter the number of lines you want: 5 1 12 123 1234 12345 ...

what will be outputs

Question 1- class A {                 public static void main(String args[])                 {                                 try                                 {                                                 return;         ...