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

atm..wrong answer..cannot find the reason..

$
0
0

Below is the code that i wrote but it always shows"wrong answer" when i submit it.Can some please tell me what is wrong in it? thanx in advance...

#include <iostream>
#include <iomanip> 
using namespace std;

int main()
{
    int x;
   float y;
   cin>>x;//withdraw
   cin>>y;//balance

   if(x<0||x>2000||y<0||y>2000)
     return 0;
   if(x>y)
     { cout.precision(2);
       cout<<fixed<<y;
     }
   else
     { if (x%5==0)
         {   cout.precision(2);
             cout<<fixed<<y-x-0.50;
         }
       else

         {   cout.precision(2);
             cout<<fixed<<y;
         }
     }   
   return 0;

}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



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