Lab Assignment240924
Lab Assignment240924
Sample Input 1: 15
Sample Output 1: 35
Sample Input 2: 60
Sample Output 2: 20
2. Write a C program that verifies an input number is divisible by 3 or 7 and falls between
100 and 500. If the condition is satisfied the program should print 1 otherwise it should
print 0
Sample Input 1: 42
Sample Output 1: 0
3. Write a C program that takes three numbers as input. If all numbers are distinct,
output the difference between the second highest and lowest. If all three numbers are
equal, output the sum of all. If any two numbers are equal, print the sum of the lowest
and highest
The program should then display the following message if the member is eligible for
discount:
OR if the member is not eligible for discount, then the program should display the
following message
Print Sorry, you do not qualify for the special discount on membership renewal.
(Reason for not qualifying should also be printed)
Sample Input:
Sample Output:
Sorry, you do not qualify for the special discount on membership renewal.
(Attendance < 80%)
5. Write a C program to calculate the electricity bill (accept number of units from the
user) according to the following criteria:
• First 50 units Rs. 0.0 per unit and service charge Rs. 0.30 per unit.
• Next 50 units Rs. 1.50 per unit and service charge Rs. 0.40 per unit.
• Next 100 units Rs. 2.50 per unit and service charge Rs. 0.50 per unit.
• After 200 units Rs. 3.75 per unit and service charge Rs. 0.60 per unit.
(50*0.0+50*0.30)+(50*1.50+50*0.40)+(100*2.50+100*0.50)+(150*3.75+150*0.60)=1062.5
6. A fitness app rewards users with badges based on their workout performance. The
badges are awarded according to the following rules:
If a user completes at least 5 workouts in a week, they receive the "Week Warrior" badge.
If a user burns more than 500 calories in a single workout, they receive the "Calorie
Crusher" badge.
If a user logs a workout every day for a month (at least 28 workouts), they receive the
"Monthly Streak" badge.
If a user achieves both the "Week Warrior" and "Calorie Crusher" badges, they receive
the "Fitness Champion" badge.
Write a C program that takes the number of workouts completed in a week, the calories
burned in a workout, and whether the user has logged a workout every day for a month
as inputs. The program should then determine which badges the user has earned and
display the results accordingly.
Sample Input:
Sample Output: