ATM :easy problems

c

#1

#include<stdio.h>
int main()
{

int wid;
float bal;
scanf("%d",&wid);
scanf("%f",&bal);
if(wid >0 && wid<=2000 && bal >=0 && bal<=2000)
{
    if(wid%5==0 && wid<=bal )
    {
        printf("%.2f",(bal-wid-.50));

    }
    else if(wid>bal)
    {
        printf("%.2f",bal);
    }
    else

    {
        printf("%.2f",bal);
    }

}


return 0;

}


#2

#include<stdio.h>
int main()
{
int a[5],b[10],c;
printf(“Enter the 4 digit password”);
scanf("%d",&a);
printf(“Enter the amount:”);
scanf("%d",&b);
if(a>=a[5])
{
elseif(b>1000)
{
printf(“Transaction proceed”);
}
else
{
printf(" transaction not allowed");
}
return(0);
}


#3

Machine will accept the transaction only if the balance in account remains non negative after the transaction. When an amount to withdraw and balance in account are same, transaction will not be successful as bank charges $0.50. So finally bal-wid-.50 should remain non-negative after the transaction.
For that change if condition to if(wid%5==0 && wid+0.50<=bal )


#4

You are missing the case when wid=bal . In this case the transaction will fail because bank will not get its 0.50$ .The condition to check should be: bal >= wid + 0.50