HS08TEST - Editorial

Read the post directly before yours :slight_smile:

1 Like

Sorry :slightly_smiling_face:

1 Like

#include <stdio.h>

int main()
{
int x,y;
int v= 2000;
printf(“Balance:- %d\n”,y);
printf(“Enter the Withdrawl Amount:- “);
scanf(”%d”,&x);
printf(“Enter Balance”);
scanf("%d",&y);

if('0<x<=v' && '0<=y<=v')
{
    if(x%5 == 0)
    {
        y= y-x-0.50;
        printf("Remaining Balance:- %d\n",y);
        printf("Amount withdrawed:- %d\n",x);
        
        
    }
    else if(x>y)
    {
        printf("insufficient fund");
    }
    else
    {
        printf("Transaction Error");
        printf("%d\n",x);
        printf("%d\n",y);
    }
}
else
{
    printf("Wrong Input Withdrawl amount should Less than equal to 2000");
}

}

can any one help me with it , its saying wrong solution

TRY THIS!!!

#include <stdio.h>

int main() {

    int X;
    float Y, balance=0;
    scanf("%d%f", &X, &Y);
    
    if (X % 5 != 0 || Y < X) {
        printf("%f\n", Y);
    }
    else if (X % 5 == 0 && Y < (X + 0.50)) {
       printf("%f\n",Y);
    }
    else if (X % 5 == 0 && Y >= (X + 0.50)) {
       balance = Y - X - 0.50;    
       printf("%f\n",balance);
    }
return 0;

}

Can anyone help and tell me whats the problem here?
My code :Solution: 56508216 | CodeChef