Saturday 29 December 2012

Mobile Bill Generator Program in C

#include<stdio.h>

int main()
{
    int calls,c1; float bill,rental;
  
    printf("Program for call billing\n\n");
    printf("                    WELCOME TO RELAINCE COMMUNICATION \n\n\n");
    printf("Enter the no. of Calls= ");
    scanf("%d",&calls);

    if (calls>0 && calls<=100)   /*100*0-->rs.0/call 100*.50-->50 paisa/call*/
        bill=calls*0;

    else if (calls>100 && calls<=200)
          {    c1=calls-100;
        bill= (100*0)+(c1*1);  }

    else if (calls>200 && calls<=300)
          {    c1=calls-200;
        bill=(100*0)+(100*1)+(c1*0.5);  }

    else if (calls>300 && calls<=500)
          {    c1=calls-300;
        bill=(100*0)+(100*1)+(100*0.5)+(c1*0.3); }

    else
          {    c1=calls-500;
        bill=(100*0)+(100*1)+(100*0.5)+(100*0.3)+(c1*0.2); }

    rental=bill+100;

    printf("Your Monthly bill is=Rs.%0.2f \n",bill);
    printf("Your Complete bill with monthly Rental charge is=Rs.%0.2f",rental);
    return 0;
}

No comments: