What's Wrong with this code?

#include “stdio.h”

int main()
{
	 
	float initial;
	int amount;
	scanf("%d%f",&amount, &initial);

	if(amount<initial && amount%5 == 0)
		printf("%0.2f", initial-amount-0.50);
	else
		printf("%0.2f", initial);

	return 0;
}

this is your corrected code…

#include "stdio.h"

int main()
{

    float initial;
    int amount;
    scanf("%d%f",&amount, &initial);

    if(amount+.5<initial && amount%5 == 0)//error was here
        printf("%0.2f", initial-amount-0.50);
    else
        printf("%0.2f", initial);

    return 0;
}

hope u get your mistake…:slight_smile:

2 Likes

Thank you very very much :slight_smile:

glad could help…:slight_smile:

//