#include < stdio.h >
void main ()
{
int w;
float b;
scanf("%d %f",&w,&b);
if ((w%5==0)&&((b-0.5)>w))
printf("%.2f",(b-0.5-w));
else
printf("%.2f",b);
}
whats wrong in this?
#include < stdio.h >
void main ()
{
int w;
float b;
scanf("%d %f",&w,&b);
if ((w%5==0)&&((b-0.5)>w))
printf("%.2f",(b-0.5-w));
else
printf("%.2f",b);
}
whats wrong in this?
There are a few things you have to follow when submitting code to an online jusge:
Always declare your main as int main and not void main
Return a 0 at the end of main i.e. return 0;
Generally print each answer on a new line i.e. add a ā\nā after printf
Also in your condition, it should be b - 0.5 >= w as the balance can be zero after the transcation.
also make sure that they cant give a negative withdrawl
for example w = -120
Sorry?
Positive integer 0 < X <= 2000 - the amount of cash which Pooja wishes to withdraw.