Tuesday, November 14, 2017

ATM Codechef Problem Solution

https://www.codechef.com/problems/HS08TEST

In C++....................

#include<bits/stdc++.h>

using namespace std;

int main()

{
   int X;

  float Y,z,n=0;
   scanf("%d",&X);
   scanf("%f",&Y);
    n=X+0.5;
    if(n>Y)
    {
    printf("%f\n",Y);
    }
    else
    {
    if(X%5==0)
    {
    z=Y-n;
    printf("%.2f\n",z);
    }
    else
    {
    printf("%f\n",Y);
    }
    }
    return 0;
}

1 comment: