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

ATM : C++ result showing wrong result

$
0
0

I have written following code for ATM problem. I dont understand why codechef is showing result as wrong answer?

 #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int x;
float y = 120.00;
cin>>x;
float t = (float)x+0.50;
if(t<=y && x%5==0 && x>0)
{
y=y-t;
cout<<fixed << setprecision(2) <<  y << endl;
}
else
cout<<fixed << setprecision(2) << y<< endl;
return 0;
}

Viewing all articles
Browse latest Browse all 39796

Trending Articles



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