Friday, March 28, 2014

Sample program to subtract cradits from total amount you have deposited.

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

    float account,cradits,limit,balance,charges,ne;
    while(account!=-1)
    {
    printf("\nEnter Account No. (-1 to end) : ");
    scanf("%f",&account);

        if (account==-1)
        break;
        else
    printf("\nEnter your Balance : ");
    scanf("%f",&balance);
    printf("\nEnter total Charges : ");
    scanf("%f",&charges);
    printf("\nCradits : ");
    scanf("%f",&cradits);
    printf("\nCradit Limit : ");
    scanf("%f",&limit);

    ne=(balance+charges)-cradits;
    printf("Your new balance is : %.2f \n\n",ne);


     if(ne>limit)
      {

        printf("\nAccount No. : %.2f",account);
        printf("\nCradit Limit: %.2f",limit);
        printf("\nNew Balance : %.2f",ne);
        printf("\nCradit Limit Exceeded.");
        printf("\n");
      }
    }
    return 0;
}

No comments:

Post a Comment