C PROGRAMMING

write a c program to calculate call charges

#include<stdio.h>

main()
{
int noc;
float res;
printf("Enter the number of callsn");
scanf("%d",&noc);
if(noc<=50)
{
printf("NILL ! no chargesn");

}
else if(noc<=100)
{
res=noc*0.80;
printf("charges is %fn",res);
if(res>250)
{
printf("Bill is %f you need to pay it to continue servicesn",res);
}
}
else if(noc<=250)
{
res=noc*1.0;
printf("charges is %fn",res);
if(res>250)
{
printf("Bill is %f you need to pay it to continue servicesn",res);
}
}
else if(noc<=600 || noc<=1000)
{
res=noc*1.20;
printf("charges is %fn",res);
if(res>250)
{
printf("Bill is %f you need to pay it to continue servicesn",res);
}
}

else if(noc>1000)
{
res=noc*1.50;
printf("charges is %fn",res);
if(res>250)
{
printf("Bill is %f you need to pay it to continue servicesn",res);
}
}
}

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button