Issue with HS08TEST problem

I tried to give a solution to this problem in C language.

Here below is my code:

#include <stdio.h>

int main()
{
int x;
float y;
printf(“Input:\n”);
scanf("%d %f",&x,&y);
if((0<x && x<=2000) && (0<=y &&y<=2000.00))
{ printf(“Output:\n”);
if(x%5==0 && (float)x<=y)
printf("%.2f",y-x-0.50);
else
printf("%.2f",y); }
else
exit(1);

return 0;

}

Please point out the error that I have made.


You have not covered all the edge cases.

1 Like

Thank you very much. I corrected it after this post, but even then it showed error. But later I realized that I shouldn’t display “Input” , “Output”.
Thank you very much.

My pleasure :slightly_smiling_face:

Please format your code next time :slightly_smiling_face: