+ 4
Code coach problem Argentina failed in case 5
What's the problem in my code #include <stdio.h> int main() { int a,b; scanf("%d%d",&a,&b); b=b*50; if(a<b){ printf("Pesos"); }if(a>b){ printf("Dollars"); } return 0; }
9 Answers
+ 2
The thread where you also posted your question contains the fix for your code. Check Diego's answer.
https://www.sololearn.com/Discuss/2125936/?ref=app
+ 3
Mihai Apostol and 高于鈞 I am extremely sorry for my mistake. I didn't noticed it.
Please forgive me @Mihai Apostol. 😔😔
+ 2
Mihai Apostol I see. Thanks for the answer!
+ 2
高于鈞 Yes. In this multiplication causes overflow, Integer range exceeds. so disivion will work perfectly.. You can ask here directly, when some available here.. Posting others thread confused me... Ok..!
+ 2
Tanmay Gupta Hello Mihai Apostol just remind me that using int will overflow in case 5, it's just a hint.
+ 1
高于鈞 You're welcome.
+ 1
Jayakrishna After I changed b=b*50 to a=a/50 it's work.
0
Do you have any difficulty by this program?
Is it still unsolved? Asking because you posted this in other thread..
0
//Let me code this.You can try this for your conditions//
#include<stdio.h>
int main()
{
int a, b;
printf(" Enter A:%d");
scanf("%d",&a);
printf("Enter B:%d");
scanf("%d",&b);
a=a/50;
b=b*50;
if(a<b)
{
printf("Pesos");
}
else
{
printf("Dollars");
}
return 0;
}