A book library rents novels for Rs.20 a week and magazines for Rs.5 a day. Write a program to calculate the total charge for a customer‟s book rentals. The program should prompt the user for the number of each type of books and output the total cost.
Answers
Answer:
C programming
Explanation:
#include<stdio.h>
#include<conio.h>
int main
{
int days,weeks, total, novel_price,ch, magazine_price;
printf("Hey Student Welcome to book Rental\n");
printf("What you like to borrow from this Book rental?\n");
printf("1 for Magazine or 2 for Novels 3 for both\n");
printf("Enter your choice \n");
scanf(&ch);
if(ch==1){
printf(" Enter the no. of week like to borrow \n");
scanf(&week);
novel_price=week*20;
printf("Price to be paid Rs%d",novel_price);
}
if(ch==2){
printf(" Enter the no. of day like to borrow \n");
scanf(&day);
magazine_price=day*5;
printf("Price to be paid Rs%d",magazine_price);
}
if(ch==3){
printf(" Enter the no. of week like to borrow \n");
scanf(&week);
novel_price=week*20;
printf(" Enter the no. of day like to borrow \n");
scanf(&day);
magazine_price=day*5;
total=magazine_price+novel_price;
printf("Price to be paid Rs%d",total);
}
return 0;
}
Thank you .
pls check error!