[SOLVED] Please tell me what's wrong with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[SOLVED] Please tell me what's wrong with this code?

#include <stdio.h> int main() { int dollars, pesos; scanf("%d",&pesos); scanf("%d",&dollars); if(dollars*50 > pesos) { printf("Pesos"); } else { printf("Dollars"); } return 0; } All time it shows me fail in last test case.

21st Aug 2020, 3:52 AM
axita
axita - avatar
4 Answers
+ 4
May be its a skee-ball Challenge mention problem also it will be better for community to understood your question. you need little change in if condition if( points /50<cost) Replace with / in instead of multiplication operator.
22nd Aug 2020, 8:10 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
I use this: if (a / 50 > b) a is pesos, b = dollars.
21st Aug 2020, 4:28 AM
Paul
Paul - avatar
+ 2
You can take value float not int Like-: float dollars ,pesos;
21st Aug 2020, 4:03 AM
Akash Agrawal
Akash Agrawal - avatar
+ 1
Keep scanf stmt below printf stmt
21st Aug 2020, 9:20 AM
Sevda Krithika Sharma
Sevda Krithika Sharma - avatar