Code :
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch;
int people, age[100], i, count=0;
float cost, discount;
printf("Welcome\n");
printf("\nEnter the package type :");
printf("\nType 'R' for room only \nType 'M' For room and meals :
\n");
scanf("%c", &ch);
if(ch == 'R'){
printf("\nEnter Number of persons who share a room : ");
scanf("%d", &people);
if(people % 3 == 0){
cost = (people/3)*1000;
}else{
cost = (people/3 + 1)*1000;
}
printf("\n\n cost for %d people is : %.2f $ (maximum 3 people can
share room). \n\n\n", people, cost);
}
else if(ch == 'M'){
printf("\nEnter Number of persons who share a room : ");
scanf("%d", &people);
printf("\nEnter age of each person : ");
for(i = 1; i<= people; i++){
printf("\nEnter age of person %d : ", i);
scanf("%d", &age[i]);
if(age[i] <= 17){
count ++;
}
}
if(count == 0){
discount = 0;
}
else if(count ==1 ){
discount = 50;
}
else {
discount = 80;
}
if(people % 3 == 0){
cost = (people/3)*1000 + 200*people - discount;
}
else {
cost = (people/3 + 1)*1000 + 200*people - discount;
}
printf("\n\n cost for %d people is : %.2f $ (maximum 3 people can
share room) .\n\n\n", people, cost);
}
else{
printf("\nEnter a valid choice .");
}
return 0;
}
-----------------------------------------------------------------------------------
Sample outputs :
if you have any doubts then you can ask in comment section. If you find the solution helpful then you can upvote the answer. Thank you.
A cruise ship offers the following packages for 5 day / 4 night Cruise & Stay....
Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first summer job. Even though his parents are claiming him as a dependent he wants to file a return in order to get his refund. He receives his W-2 and decides he can do his own return using form 1040-EZ. Which of the following information is not found on a Form W-2? a) The taxpayer’s Social Security number b) The taxpayer’s wages, tips and other...
SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the company's new line of single-serve coffee pods or to await results from the product's launch in the United States. Key strategic decisions include choosing the target market to focus on and determining the value proposition to emphasize. Important questions are also raised in regard to how the new product should be branded, the flavors to offer, whether Kraft should use traditional distribution channels or...