Q7. Greedy7
Predict the output : for(input 5 , 14)
Double x;
int y;
for(i=0;i<2;i++)
{ cin>>y;
x=(32-x)*(5/9);
cout<<setprecision(3)<<x<<” ”;
}
15 10
15.000 10.000
0 0
1510
Q7. Greedy7
Predict the output : for(input 5 , 14)
Double x;
int y;
for(i=0;i<2;i++)
{ cin>>y;
x=(32-x)*(5/9);
cout<<setprecision(3)<<x<<” ”;
}
15 10
15.000 10.000
0 0
1510
answer should be 0 0
because
5/9 is zero as integer/integer= integer
so output is 0 0
to get desired output you have typecase 5 to double