Sunday, 5 November 2017

java full important input output problems using conditions



Problem 01:
What is the output of  the following question
Int number=222;
if (number % 2 == 0)
System.out.println(number + " is even");
if (number % 5 == 0)
System.out.println(number + " is multiple of 5");
Output:
222 is even
Problem 02:

What is the output of  the following question

int a=99,b=44;
    if(a>b)
        System.out.println("The maximum number is a= "+a);
    else
        System.out.println("The maximum number is b= "+b);
Output:
The maximum number is a=99
Problem 03:
What is the output of  the following question
int a=3,b=4,c=1;
 if(a==b)
     System.out.println("a and b are equal");
 else if(a==c)
     System.out.println("a and c are equal");
 else
     System.out.println("Nothing are equals");
Output:
Nothing are equals

No comments:

Post a Comment