What is error in code? Problem Code: HS08TEST

#include<stdio.h>
int main()
{
int b; float t;
scanf("%d%f",&b,&t);
if(b%5==0)
{
if (b<t)
{ float i;
i=(t-b)-.50;
printf("%f",i);}
else if(b>t)
{printf("%f",t);}}
else{printf("%f",t);}
return 0;
}

Your code is perfect

You have to output the result with two digits of precision.

Modify these lines printf("%f", i);
to → printf("%0.2f", i);

2 Likes

float b; /instead of int b/
int t; /instead of float t/
because pooja is withdrawing integer value, also after transaction a/c balance will be = "initial amount-withdrawal-0.5 " it should be float.