+ 1

What is the problem in case 5?

#include <stdio.h> int main() { int dollars,pesos; scanf("%d",&pesos); scanf("%d",&dollars); dollars=dollars*50; if(dollars>pesos) { printf("Pesos"); } else { printf("Dollars"); } return 0; }

24th May 2021, 7:24 PM
Sachin Verma
Sachin Verma - avatar
6 Answers
+ 1
Just change int to double
24th May 2021, 7:37 PM
Atul [Inactive]
+ 1
#include <stdio.h> int main() { float dollars,pesos; scanf("%f",&pesos); scanf("%f",&dollars); dollars=dollars*50.0; if(dollars>pesos) { printf("Pesos"); } else { printf("Dollars"); } return 0; }
24th May 2021, 7:45 PM
Atul [Inactive]
0
Atul Nhi ho raha h yrr Double me.change karne ke baad to case 1,4,5 bhi nhi chal raha
24th May 2021, 7:44 PM
Sachin Verma
Sachin Verma - avatar
0
Thanks Atul
24th May 2021, 7:47 PM
Sachin Verma
Sachin Verma - avatar
0
You have tried to convert two numbers that should be compared on some common criterion...by type casting to int
25th May 2021, 12:20 PM
Sanjay Kamath
Sanjay Kamath - avatar