this is my code for the atm problem… plz anyone tel me y do i get runtime error. help!
#include<stdio.h>
int main()
{
int a;
float b;
scanf("%d %f",&a,&b);
if((a%5)!=0)
printf("%.2f",b);
else if(((float)a+0.50)>b)
printf("%.2f",b);
else
{ b= b-a-0.50;
printf("%.2f",b);
}
}
1 Like
You are getting a NZEC runtime Error.
NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Java/C++ could generate this error if they throw an exception.
Refer this LINK
Thus add return 0 statement at the end of your code,it will get accepted.
#include<stdio.h>
int main()
{
int a;
float b;
scanf("%d %f",&a,&b);
if((a%5)!=0)
printf("%.2f",b);
else if(((float)a+0.50)>b)
printf("%.2f",b);
else
{ b= b-a-0.50;
printf("%.2f",b);
}
return 0;/*You Were getting NZEC due to missing of this statement from your code*/
}
1 Like