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 :CodeChef: Practical coding for everyone

editor code is wrong which you providing for this ATM question :-
//Code in C++
include
using namespace std;
int main()
{
int withdraw;
float balance;
cin>>withdraw;
cin>>balance;
if ((withdraw%5==0)&&(balance>(withdraw+0.50)))//(Checks if money to be withdrawn is a multiple of 5 and the balance is enough
cout <<(balance-withdraw-0.50);
else
cout<<balance;
}

this is wrong and i submit it and get wrong submit =1 in my profile .
here is the write code my me:-
//Code in C++
include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int withdraw;
float balance;
cin>>withdraw;
cin>>balance;
if ((withdraw%5==0)&&(balance>=(withdraw+0.50)))
{cout<<(balance-withdraw-0.50);}
else{cout<<balance;}
return 0;

}

so please may you remove wrong submit = 1 from my profile and also update the editorial code attach ot it.