this program will compute two numbers and get the sum, difference, product and quotient. x=5, y=6.
program code:
import java.io.*;
public class Computation
{
public static void main(String args[])
{
//Declaration
int x=5;
int y=6;
int sum=0;
int diff=0;
int prod=0;
int quo=0;
//computation
sum= x + y;
diff= x - y;
prod= x * y;
quo = x / y;
//Display result
System.out.println("The sum is:" + sum);
System.out.println("The diff is: + diff);
System.out.println("The prod is: + prod);
System.out.print("The Quo is: + quo);
}
}
No comments:
Post a Comment