Chapter 2 Program 10

Also visit our YouTube Channel Tech Eos    VISIT CHANNEL



/* 10. Write a program to calculate bill of a job work done as follows.
Use if else statement.
a) Rate of typing 3 Rs/page
b) Printing of 1st copy 5Rs/pages & later every copy 3Rs/page.
The user should enter the number of pages and print out copies
   he/she wants.
*/

#include<stdio.h>
#include<conio.h>

void main()
{
int pages , copies ;
int typing_cost=0;
int printing_cost=0;
int printing_cost2=0;

clrscr();

printf("\nEnter total number of pages  : ");
scanf("%d" , &pages);

printf("\nEnter total number of copies : ");
scanf("%d" , &copies);

typing_cost = pages*3;

printf("\n\nTyping cost is %d " ,  typing_cost );

if( copies == 1 )
{
printing_cost = pages*5;
printf("\n\nPrinting price of 1 copie is %d" , printing_cost);
}
else if( copies > 1 )
{
// 1 copy
printing_cost = pages*5;

printing_cost2= pages*3;

printf("\n\nPrintin price is %d" ,(printing_cost+printing_cost2));
}

getch();
}

Comments

Popular posts from this blog

Maximum from three numbers (Nested If ) (Chapter 2 Program 2 )

( Chapter 2 Program 7 )

Modular operator in c ( Chapter 1 Program 9)