REGARDING ATM PROBLEM IN BEGINEER SECTION

WHY IS MY SOLUTION WRONG CAN ANYONE PLZ HELP!!!

#include<stdio.h>
int main()
{
    int y,t;
    float x,z;
    scanf("%d%f",&y,&x);
    z=y+0.5;
    if(z<=x)
    {
        t=0;
    }
    else
    {
        t=1;
    }
    if((y%5)!=0)
    {
        t=1;
    }
    else
    {
        t=0;
    }
    if(t==0)
    {
        printf("\n %.2f",x-y-0.5);
    }
    else if(t==1)
    {
        printf("\n %.2f",x);
    }
    return 0;
}

Try out test case

100 50

Transaction should not be possible but your answer is wrong.

YES BUT WHAT IS THE ISSUE IN CODE

You are checking the mentioned conditions separately so it will work as OR operation that is if either entered amount is divisible by 5 OR the entered amount can be withdrawn, it will account for the successful transaction but it should not.

So instead take AND operation i.e. move your second if-else block inside the first if block which will lead to t=0 only when first the amount can br withdrawn and then check if it is divisible by 5 not.

ok thanks so if you have a code with two if loops it will check for it as seperately and if only one also tends to be succesfull it will proceed

Yes two different if statements/block execute separately and the result depends upon what you are doing inside the if blocks.