+ 1

Test case 5 is not working for Argentina code coach problem

#include <iostream> using namespace std; int main() { int pesos; int dollars; cin>>pesos; cin>>dollars; int answer=dollars*50; if(answer>=pesos){ cout<<"Pesos"; } else { cout<<"Dollars"; } return 0; }

22nd Dec 2019, 7:50 PM
Shahraiz Kayani
Shahraiz Kayani - avatar
3 Antworten
+ 2
I understood know I was using int I had to use double.
22nd Dec 2019, 8:41 PM
Shahraiz Kayani
Shahraiz Kayani - avatar
+ 3
Solved first code works by using double
22nd Dec 2019, 9:04 PM
Shahraiz Kayani
Shahraiz Kayani - avatar
+ 1
Can you tell me the difference b/w the code above and this. I think logic is same in both #include <iostream> using namespace std; int main() { int pesos; int dollars; cin>>pesos; cin>>dollars; int answer=pesos/50;; if(answer<=pesos){ cout<<"Pesos"; } else { cout<<"Dollars"; } return 0; }
22nd Dec 2019, 8:37 PM
Shahraiz Kayani
Shahraiz Kayani - avatar