C2025E INTRODUCTION TO C PROGRAMMING
Department of Electronics and Communication Engineering
National Institute of Technology Calicut
Winter 2024-25
Questions Set 1
1. A bakery sells cakes for 150 each. Write a C program that takes the number of
cakes a customer wants to buy as input and calculates the total cost, applying a 10%
discount if the total cost exceeds 1000.
2. Write a function that checks if a given year is a leap year.
3. A weather station records temperatures in Fahrenheit. Write a program that asks
the user to enter a Fahrenheit value and displays the equivalent Celsius value.
4. A university follows this grading system:
• 90+ = ’A’
• 80-89 = ’B’
• 70-79 = ’C’
• 60-69 = ’D’
• Below 60 = ’F’
Write a program that takes a student’s marks as input and displays the
corresponding grade.
5. Write a program that takes a number from the user and counts how many digits it
has.
6. Write a program to generate all combinations of ‘c’, ‘a’ and ‘t’.
7. A group of friends go to a restaurant and decide to split the bill equally. Write a
program that takes the total bill amount and the number of friends as input and
displays the amount each person should pay.
[Link] a program to find the arithmetic sum of the first n natural numbers.
9. A traffic camera checks the speed of vehicles and gives fines:
• Below 60 km/h → No fine
• 61-80 km/h → 500 fine
• 81-100 km/h → 2000 fine
• Above 100 km/h → 5000 fine
Write a program that asks the user for their speed and calculates the fine.
10. Write a program to enter a character through keyboard and check whether it is
an alphabet or a special character.
11. Write a program that calculates the sum of the digits of an integer.
12. Write a program to check if integer m is prime or composite