Lab 1
Lab 1
1. Write a C program to create a structure named Distance with data members feet and inches.
Read a Distance input and convert it to inches completely. For example, if the input entered
for feet and inches is 10 and 40 respectively, your program should print the output as 160
inches as the output.
2. Write a C program to create a structure named Money with data members rupee and paise.
Read a money input from the user and convert it to paise completely. For example, if the
entered input is 25 rupees and 40 paise, your program should print 2540 paise.
3. Write a C program to create a structure named Bank with the data members name, location
and count, where count represents the total number of positive reviews from the customers.
Read an input from the user and print whether the bank can be rated as one among top Five
or not based on the following, if the count is above 1000 and city is Bangalore, give a five-
star rating. If the count is above 1000 and city is other than Bangalore, give a three-star
rating, for all other cases give a single star rating. Print the message according to your input.
4. Write a C program to create a structure named Hotel with data members to store name, cost
of the room and total number of rooms available. Read an input from the user. Also, read the
total number of rooms needed by a user and find the total cost for him based on the
availability. For example, if the user needs 3 rooms and if the rooms are available, them find
the total cost for him. If the rooms are not available or it is lesser than the limit available then
print the relevant messages.
5. Write a C program to create a structure named Book with the data members bookname, cost
of the book and the number of copies available. Read an input from the user. Ask the user for
the number for the number for copies needed, and if the copies are available, then print the
total cost for him. If the sufficient copies are not available, print suitable error messages.