this is the ATM question of prcatice section. I think my codes are correct why is it still showing wrong submission can someone tell me where i am wrong
#include <stdio.h>
int main()
{
float x, balance, newbal;
printf("enter the amount to withdraw amount and avaialble bal \n");
scanf("%f %f", &x, &balance);
if ((int)x % 5 == 0 && balance > (x + 0.5))
{
newbal = balance - (x + 0.50);
printf("available balance is %.2f", newbal);
}
else
{
printf("the balance is %.2f", balance);
}
return 0;
}
don’t print “the balance is” these things you only need to print the amount and set the precision to two also after decimal place.
#include
using namespace std;
int main() {
// your code goes here
int withdraw;
double bal;
cin>>withdraw;
cin>>bal;
double rem_bal;
if(withdraw%5==0)
{
if(bal>withdraw && bal>=(withdraw+0.5))
{
rem_bal=bal-withdraw-0.50;
cout<<rem_bal<<endl;
}
else
{
cout<<bal<<endl;
}
}
else
{
cout<<bal<<endl;
}
return 0;
}
Here just you need to print the value of the remaining value. you are printing with message as well. see above solution that may help you