My code won't pass test #5. What's wrong with it? Problem Argentina | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My code won't pass test #5. What's wrong with it? Problem Argentina

#include <iostream> using namespace std; int main() { int peso, dollar, conv; string p = "Pesos"; string d = "Dollars"; cin >> peso; cin >> dollar; conv = dollar * 50; if ( peso > conv) { cout << d; } else cout << p; return 0; }

14th Sep 2020, 12:05 AM
Vlad Vizitiu
Vlad Vizitiu - avatar
1 Answer
+ 2
Looks like the last test case is big enough to not fit in *int* as using *long int* fixes the problem. Here is the fix👇 https://code.sololearn.com/cWl6AG5OFqI4/?ref=app
14th Sep 2020, 12:44 AM
Arsenic
Arsenic - avatar