(abc = 2.5, big = 2, assume g to be a float)
2 / 2 + 2 * 4 / 2 - 2 + 2.5 / 3;
1 + 2 * 4 / 2 - 2 + 2.5 / 3;
1 + 8 / 2 - 2 + 2.5 / 3;
1 + 4 - 2 + 2.5 / 3;
1 + 4 - 2 + 0;
5 - 2 + 0;
3+ 0
so
g = 3
(b) on = ink * act / 2 + 3 / 2 * act + 2 + tig ;
(ink = 4, act = 1, tig = 3.2, assume on to be an int)
4 * 1 / 2 + 3 / 2 * 1 + 2 + 3.2
4 / 2 + 3 / 2 * 1 + 2 + 3.2
2 + 3 / 2 * 1 + 2 + 3.2
2 + 1 * 1 + 2 + 3.2
2 + 1 + 2 + 3.2
3 + 2 + 3.2
5 + 3.2
8
so
on = 8
(c) s = qui * add / 4 - 6 / 2 + 2 / 3 * 6 / god ;
(qui = 4, add = 2, god = 2, assume s to be an int)
4 * 2 / 4 - 6 / 2 + 2 / 3 * 6 / 2
8 / 4 - 6 / 2 + 2 / 3 * 6 / 2
2 - 6 / 2 + 2 / 3 * 6 / 2
2 - 3 + 2 / 3 * 6 / 2
2 - 3 + 0 * 6 / 2
2 - 3 + 0 / 2
2 - 3 + 0
-1 + 0
so
s= -1
(d) s = 1 / 3 * a / 4 - 6 / 2 + 2 / 3 * 6 / g ;
(a = 4, g = 3, assume s to be an int)
1 / 3 * 4 / 4 - 6 / 2 + 2 / 3 * 6 / 3
0 * 4 / 4 - 6 / 2 + 2 / 3 * 6 / 3
0 / 4 - 6 / 2 + 2 / 3 * 6 / 3
0 - 6 / 2 + 2 / 3 * 6 / 3
0 - 3 + 2 / 3 * 6 / 3
0 - 3 + 0 * 6 / 3
0 - 3 + 0 / 2
0 - 3 + 0
-3 +0
-3
so
s = -3
hello ,
ReplyDelete(a) g = big / 2 + big * 4 / big - big + abc / 3 ;
(abc = 2.5, big = 2, assume g to be a float)
the correct answer is 3.83333
your answer is not correct , because 2.5 / 3 not equal zero , 2.5 is float , so 2.5 /3 =0.833333
Deletewhen done the same program in Turbo C, the s = 0,
Deletedid you tried this??
Yes. The answer is 3.83 for (a).
DeletePlease make the corrections.
Thank you!
WITH THE QUESTION (d):
ReplyDelete0 - 3 + 0 * 6 / 3 IS DONE THIS WAY.
0*6 FIRST THEN YOU GET -3 + 0 / 3
WHICH WILL GIVE YOU -3+0, WHICH IS THE SAME -3.
THANK YOU.
This comment has been removed by the author.
ReplyDeleteHe'llo friends
ReplyDeleteThe correct answer for
(a) g = big / 2 + big * 4 / big - big + abc / 3 ;
(abc = 2.5, big = 2, assume g to be a float)
Is 3.833333 since float is mentioned and precision for float is upto 6 decimal place
thanks bro.I was confused of the answer.
DeleteBhai integer type hai not a float type
DeleteThis comment has been removed by the author.
ReplyDeleteR=x*x+2*x+1/2*x*x+x+1
ReplyDelete3.83333
ReplyDelete3.83
ReplyDelete