Code:
#include<stdio.h>
int main()
{
char name[30],rcode,D,d,s,S,T,t;
float rprice,price;
int days;
printf("------------------------------------------\n\tWELCOME TO LEGEND HOTEL\t\t\n------------------------------------------");
printf("\nRooms : Delux(D) Twin Sharing(T) Single(S)\n\n");
printf("Enter your name\t\t :");
gets(name);
printf("Enter Room code\t\t :");
scanf("%c", &rcode);
printf("Enter number of days\t :");
scanf("%d", &days);
printf("\n\n------------------------------------------\n\tPAYMENT RECEIPT\t\t\n------------------------------------------\n");
if(rcode == D || d)
{rprice = 200.00;
price = rprice * days;
printf("Customer Name\t: %s\n", name);
printf("Room Type\t: Delux\n");
printf("Room Price\t: %.2f\n", rprice);
printf("Number of days\t: %d\n", days);
printf("Bill\t: RM%.2f\n", price);
}
else
if(rcode == T || t)
{rprice = 170.00;
price = rprice * days;
printf("Customer Name\t: %s\n", name);
printf("Room Type\t: Twin Sharing\n");
printf("Room Price\t: %.2f\n", rprice);
printf("Number of days\t: %d\n", days);
printf("Bill\t: RM%.2f\n", price);
}
else
if(rcode == S || s)
{rprice = 120.00;
price = rprice * days;
printf("Customer Name\t: %s\n", name);
printf("Room Type\t: Single\n");
printf("Room Price\t: %.2f\n", rprice);
printf("Number of days\t: %d\n", days);
printf("Bill\t: RM%.2f\n", price);
}
else
{price = 0;
price = rprice * days;
printf("Customer Name\t: %s\n", name);
printf("Room Type\t: Invalid\n");
printf("Room Price\t: %.2f\n", rprice);
printf("Number of days\t: %d\n", days);
printf("Bill\t: RM%.2f\n", price);
}
system("pause");
getche();
return 0;
}