#include<stdio.h>
#include<conio.h>
void main()
{
int numw,exw;
float less10w,rcost;
float excost,totalcost;
clrscr();
printf("\n\tEnter the number of words in the text message: ");
scanf("%d",&numw);
rcost =2.00;
if(numw>10)
{
exw =numw-10;
excost =exw*0.50;
totalcost =rcost+excost;
printf("\n\tThe number of words in the text message: %d",numw);
printf("\n\tThe number of excess words: %d",exw);
printf("\n\tThe regular cost of the message: P %.2f",rcost);
printf("\n\tThe cost of the excess words: P %.2f",excost);
}
else
{
less10w =2.0/10;
totalcost =numw*less10w;
printf("\n\tThe number of words in the text message: %d",numw);
printf("\n\tThe regular cost of the message: P %.2f",rcost);
}
printf("\n\n\tThe total cost of the text message : P %.2f",totalcost);
getch();
}
#include<conio.h>
void main()
{
int numw,exw;
float less10w,rcost;
float excost,totalcost;
clrscr();
printf("\n\tEnter the number of words in the text message: ");
scanf("%d",&numw);
rcost =2.00;
if(numw>10)
{
exw =numw-10;
excost =exw*0.50;
totalcost =rcost+excost;
printf("\n\tThe number of words in the text message: %d",numw);
printf("\n\tThe number of excess words: %d",exw);
printf("\n\tThe regular cost of the message: P %.2f",rcost);
printf("\n\tThe cost of the excess words: P %.2f",excost);
}
else
{
less10w =2.0/10;
totalcost =numw*less10w;
printf("\n\tThe number of words in the text message: %d",numw);
printf("\n\tThe regular cost of the message: P %.2f",rcost);
}
printf("\n\n\tThe total cost of the text message : P %.2f",totalcost);
getch();
}
No comments:
Post a Comment