Write a program in that generates the bill of a telephone company as follows: a. for first 100 calls the rate is fixed at Rs 250 b. for next 100 calls it is 80p per call c. for next 100 calls it is Re 1 per call d. for next 100 calls it is Rs 1.20 per call.

 // telephone-bill.c

#include <stdio.h>

#include <conio.h>


int main()

{

int calls;

float totalBill=250;


printf("Enter the number of telephone calls: ");

scanf("%d", &calls);

printf("Total bill of %d calls is ", calls);

if (calls>=300){

totalBill+= (calls-300)*1.20;

calls-=calls-300;

}

if (calls>=200){

totalBill+= (calls-200)*1;

calls-=calls-200;

}

if (calls>=100){

totalBill+= (calls-100)*0.80;

calls-=calls-100;

}


printf("%frs.", totalBill);


getch();

return 0;

}


Comments