Tuesday, July 22, 2014

Asking User to Input, while using Conditional Statement in Java

import java.util.Scanner;
public class abejeroact9 {
public static void main (String[] args) {
Scanner abejeroact9 = new Scanner(System.in);
int a;
int b;
System.out.println("Enter value for A");
a = abejeroact9.nextInt();
System.out.println("Enter value for B");
b = abejeroact9.nextInt();
if (a>b)
{
//true statement
System.out.println("A is bigger than B");
}
else
{
System.out.println("B is bigger than A");
}
}
}

No comments:

Post a Comment