Computer Science, asked by roselinsb, 10 months ago

static void main()
int a=12,b=13,c;
c=a++ + ++a/7 +b++;
System.out.println(a+"\t"+b+""+c);
C=++a + a++/3 + ++b;
System.out.println(a+"|t"+b+"\t"+c);​

Answers

Answered by sunitazirange
18

Answer:

i think you wanted the correct program and the output!

Explanation:

class program4{

public static void main(){

int a=12,b=13,c;

c=a++ + ++a/7 +b++;

System.out.println(a+"\t"+b+""+c);

c=++a + a++/3 + ++b;

System.out.println(a+"|t"+b+"\t"+c);

}

}

o/p :

14 1427

16|t15 35

no error :)

hope it helps!

plz mark me as brainliest!

Answered by ankhidassarma9
5

Answer:

OUT PUT : 14    14    27

             16    15    35

Explanation:

int a=12,b=13,c;

c=a++ + ++a/7 +b++;

System.out.println(a+"\t"+b+""+c);

  • a++    will add the value of a (i.e 12) first and then the value of ‘a’ will be incremented , a=13.
  • ++a=14,    so ++a/7=2; here first ‘a’ will be incremented by ‘1’ then the new value of ‘a’ will be divided by ‘7’.
  • b++ will add the value of b (i.e 13) first and then the value of ‘b’ will be incremented.
  • Hence : value of ‘c’ will be computed as : 12+2+13=27

C=++a + a++/3 + ++b;

System.out.println(a+"|t"+b+"\t"+c);

  • ++a will increment the value of ‘a’ first then new value a=15 will be added
  • a++/3, first a/3=15/3=5 will be performed then ‘a’ will be incremented to 16
  • ++b  first the value of ‘b’ will be incremented , b=15 and then it will be added.
  • Hence : value of ‘c’ will be computed as : 15+5+15=35

Similar questions