int a=8, b=9;
Write one statement using “if” statement, print the bigger number
Answers
Answered by
2
Explanation:
I hope I could help you out.
Attachments:
Answered by
2
Answer:
public class big{
public static void main(String at[]) {
int a=8, b=9;
if (a>b)
System.out.println(a+" is greater");
else
System.out.println(b+" is greater");
}
}
Know more!!
- You can also use ternary operator for checking which number is greater. It will help to reduce the nom of lines of your códe.
System.out.println((a>b)?a+" is greater":b+" is greater") ;
Or
int k=(a>b)? a:b;
System.out.println(k+" is greater") ;
Similar questions