0

need help solve this

int a=15 ; int b=3; int temp; temp=a; a=b; b=temp; cout<<temp/a;

10th Apr 2017, 10:47 AM
Mohd Farees Azuan
Mohd Farees Azuan - avatar
4 Answers
+ 8
int a=15 ; int b=3; int temp; temp=a; // temp is 15, a is 15, b is 3 a=b; // temp is 15, a is 3, b is 3 b=temp; // temp is 15, a is 3, b is 15 cout<<temp/a; // temp/a is 15/3 // outputs 5
10th Apr 2017, 11:21 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
a=15 , b=3 temp= a , a=b, b=temp temp=15 , a=3, b=15 so temp/a=5
10th Apr 2017, 10:57 AM
Sagheb
Sagheb - avatar
0
5
10th Apr 2017, 10:54 AM
Ashish Jain
Ashish Jain - avatar
0
temp=15 a=3 b=temp so what you are doing is dividing temp(15)/a(3)
10th Apr 2017, 10:58 AM
Alejandro Herrera
Alejandro Herrera - avatar