Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

cant understand why it is showing wrong answer

$
0
0

include <iostream>

include <iomanip>

int main() { using namespace std;

int wdraw;
float bal;
float left;
cin >> wdraw;
cin >> bal;

if(wdraw <= bal)
{
    if(wdraw%5==0){
        left = bal-wdraw-0.50;
        cout << fixed << setprecision(2) << showpoint << left << endl;
        }
     else{

        cout << fixed << setprecision(2) << showpoint << bal << endl;

          }
}
else
{
        cout << fixed << setprecision(2) << showpoint << bal << endl;
}
return 0;

}

this is the ATM question in the easy section of the practice problems. on submitting ,it shows Wrong Answer. I have tried every possible input and it is giving me the correct answer on my compiler.

please help.


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>