Tuesday, July 22, 2014

Ask Input to the User; Using Mathematical Operations in Java

import java.util.Scanner;
public class abejeroact5 {
public static void main (String[] arguments) {
Scanner abejeroact5 = new Scanner(System.in);
double sum;
double a,b;
System.out.println("Enter value for A");
a = abejeroact5.nextDouble();
System.out.println("Enter value for B");
b = abejeroact5.nextDouble();
sum = a+b;
System.out.print("Sum is " +sum);
}
}

No comments:

Post a Comment