Computer Science, asked by archanamahata44, 9 months ago

You visit a shop to get your assignment typed and printed. WAP to calculate bill of a job work based on following rates.
Rate of typing is Rs. 3/- per page
Printing of fist copy if Rs. 5/- per page and later every copy Rs. 3/- per page.
User should enter the number of pages in assignment and no. of print out copies your group want. ​

Answers

Answered by mad210203
0

Program is given below.

Explanation:

#include <stdio.h>

void main()

{

int rate_of_typing=3,cost_for_printing_first_copy=5,cost_for_printing_for_later_copies= 3,nop,noc,cost_of_typing,cost_of_printing_1,cost_of_printing_r,cost_of_printing_t,total_cost;

printf("Enter the number of pages in assignment: ");

scanf("%d",&nop);

cost_of_typing=nop*rate_of_typing;

printf("Cost of typing %d page/pages = Rs: %d",nop,cost_of_typing);

printf("\nEnter the number of copies: ");

scanf("%d",&noc);

if(noc==1)

{  

cost_of_printing_1=nop*cost_for_printing_first_copy;

printf("Cost of printing %d page/pages (First copy) = Rs: %d\n",nop,cost_of_printing_1);

cost_of_printing_r=0;

}

else

{  

cost_of_printing_1=nop*cost_for_printing_first_copy;

printf("Cost of printing %d page/pages (First copy) = Rs: %d\n",nop,cost_of_printing_1);

cost_of_printing_r=(noc-1)*nop*cost_for_printing_for_later_copies;

printf("Cost of printing %d page/pages (Remaining copies) = Rs: %d\n",nop,cost_of_printing_r);

}

cost_of_printing_t= cost_of_printing_1+cost_of_printing_r;

total_cost=cost_of_typing+cost_of_printing_t;

printf("\nTotal bill = Rs: %d",total_cost);

}

Refer the attached image for the output.

Attachments:
Similar questions