Computer Science, asked by qhwexi56, 6 months ago

Write a program in java to assign integers a,b,c, d, e, f, g, h, I, j, k, l, m, n with values 2,3,4,6,7,18,14,16,17,28,5,20,1. Perform the following operations and print the results of the expression; c+d*b, d/b*e, f/a+g/a, h/a, i/a, j/k, h%a, i%a, j%k, j%k*b+n, (a+b) *c and m/c+n.

Answers

Answered by anindyaadhikari13
2

Answer for the question is give below.

This is the required program.

class Operations

{

public static void main(String args[])

{

int a=2,b=3,c=4,d=6,e=7,f=18;

int g=14,h=16,i=17,j=28,k=5,l=20,m=1, n=0;

//value of n is not given so I have taken n=0

System.out.println((c+d*b));

System.out.println((d/b*e));

System.out.println((f/a+g/a));

System.out.println(h/a);

System.out.println(i/a);

System.out.println(j/k);

System.out.println(h%a);

System.out.println(i%a);

System.out.println(j%k);

System.out.println((j%k*b+n));

System.out.println((a+b)*c);

System.out.println((m/c+n));

}

}

Similar questions