Given a=3,b=15 temp=a; a=b; b=temp; b=temp/a whats its answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Given a=3,b=15 temp=a; a=b; b=temp; b=temp/a whats its answer

pls answr the question

29th Dec 2016, 3:04 PM
Sujay Biswas
Sujay Biswas - avatar
6 Answers
+ 2
First, What do you think the answer is?
29th Dec 2016, 3:13 PM
Vishal++
Vishal++ - avatar
+ 2
a = 3, b = 15 temp = a (3) a = b (15) b = temp (3) b = temp/a (3/15) Answer is 0 assuming a and b are int and int cannot display double value 0.2 (actual calculation)
29th Dec 2016, 3:38 PM
Vishal++
Vishal++ - avatar
+ 1
5 just guess bro.. coz i hv jst strted learing c++ ..concept is not clear
29th Dec 2016, 3:18 PM
Sujay Biswas
Sujay Biswas - avatar
0
Strange :D Even I thought it was 5 but it turns out to be 3/15 in the end
29th Dec 2016, 3:27 PM
Vishal++
Vishal++ - avatar
0
a=3 b=15 temp=3 a=15 b=3 b=3/3=1
5th Oct 2017, 1:22 AM
Styxincewa
Styxincewa - avatar
0
it's 0.2 really, just messing....
5th Oct 2017, 1:28 AM
Styxincewa
Styxincewa - avatar