int main() { int t; cin>>t; int a,b,c; cin>>a>>b>>c; double tmp=a+b; tmp=tmp/2; cout<<tmp<<"!"; } input is : 1 232444 123233 232434 why it is giving wrong answer:177838; why it is rounding off the value .
why double is giving wrong output
int main() { int t; cin>>t; int a,b,c; cin>>a>>b>>c; double tmp=a+b; tmp=tmp/2; cout<<tmp<<"!"; } input is : 1 232444 123233 232434 why it is giving wrong answer:177838; why it is rounding off the value .
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en2 | saurabhkumarfx | 2020-05-28 21:56:34 | 22 | |||
en1 | saurabhkumarfx | 2020-05-28 21:55:35 | 290 | Initial revision (published) |