/*PROGRAM TO PERFORM ARITHMATIC OPERATIONS THROUGH A SINGLE PROGRAM*/
PROGRAM:
SAMPLE OUTPUT:
x is 6, y is 4
x + y = 10
x - y = 2
x / y = 1
x % y = 2
a is 12.5, b is 7
a / b = 1.78571
TRY YOURSELF:4
1)Write a program to calculate your shopping expense.Imagine that you have took Rs.1000 for shopping and calculate how much you money you saved by purchasing the items in that shop.Find out your total expense and your balance amount with you.
Note:Answer will be displayed after 24 hours in solution page.
PROGRAM:
class Arithmetic
{
public static void main (String[] args)
public static void main (String[] args)
{
short x = 6;
int y = 4;
short x = 6;
int y = 4;
float a = 12.5;
float b = 7;
System.out.println(“x is “ + x “, y is “ + y);
System.out.println(“x + y = “ + (x + y));
System.out.println(“x - y = “ + (x - y));
System.out.println(“x / y = “ + (x / y));
System.out.println(“x % y = “ + (x % y));
System.out.println(“a is “ + a + “, b is “ + b;
System.out.println(“a / b = “ + (a / b));
float b = 7;
System.out.println(“x is “ + x “, y is “ + y);
System.out.println(“x + y = “ + (x + y));
System.out.println(“x - y = “ + (x - y));
System.out.println(“x / y = “ + (x / y));
System.out.println(“x % y = “ + (x % y));
System.out.println(“a is “ + a + “, b is “ + b;
System.out.println(“a / b = “ + (a / b));
}
}
}
SAMPLE OUTPUT:
x is 6, y is 4
x + y = 10
x - y = 2
x / y = 1
x % y = 2
a is 12.5, b is 7
a / b = 1.78571
TRY YOURSELF:4
1)Write a program to calculate your shopping expense.Imagine that you have took Rs.1000 for shopping and calculate how much you money you saved by purchasing the items in that shop.Find out your total expense and your balance amount with you.
Note:Answer will be displayed after 24 hours in solution page.