C Set
C Set
School of Computing
Department of Computer Science and Engineering
Subject Name: Programming in C
Subject Code: S11BLH11
Class and Section: I yr and B 3
1. A school has grades based on students' scores. Write a C program to take a student's score
as input and output their grade. The grading criteria are as follows:
A: 90 - 100
B: 80 - 89
C: 70 - 79
D: 60 - 69
F: Below 60. Implement this grading system using conditional statements.
2. You need to display a multiplication table for a given number up to 10. For instance, if
the input is 5, it should print the multiplication table of 5 up to 5×105 \times
105×10.Write a C program that takes a number as input and displays its multiplication
table.
3. A grocery store wants to calculate the total cost of items bought. Each item has a fixed
price. Write a program that takes an array of item quantities as input and another array of
corresponding item prices, then calculates the total cost. Implement a program to
calculate and print the total cost based on these arrays.
5. An employee management system needs to store and display details about each
employee, including their ID, name, age, and department. Define a structure for an
employee and write a program to input details for five employees, then display them.
6. You need to collect test scores for a class, but the number of students varies each time the
program runs. Use dynamic memory allocation to handle this scenario. Write a program
that asks the user for the number of students, then dynamically allocates memory for their
scores. After taking input, print the scores and release the allocated memory.
7. A bank wants a program to manage customer accounts. Each account has a unique
account number, customer name, and balance. The bank requires operations to deposit
money, withdraw money (with overdraft protection), and check balance. Implement a C
program using structures that simulates a simple banking system. Include functions for
each operation, and ensure the withdrawal function checks for sufficient balance before
deducting money.
8. A library wants to catalog books with details like title, author, publication year, and
unique ID. The library needs to add new books, view details of all books, and search for a
book by title or author. Write a C program using structures and dynamic memory to
manage the library. Implement functions to add a book, display all books, and search by
title or author.
9. A school needs a program to calculate and display the grades of students based on their
marks in five subjects. The program should calculate the total marks, average, and assign
a grade (A, B, C, or F) based on the average. Create a C program that reads student
marks, calculates the total and average, and assigns a grade based on predefined criteria.
Use an array to store subject marks.
10. An inventory system for a store must track product details, such as product ID, name,
quantity, and price. The program should be able to add new products, update product
quantities, and calculate the total value of the inventory. Design a C program using
structures to manage the store's inventory. Implement functions for adding products,
updating quantity, and calculating the total inventory value.
11. A hospital wants a program to store and manage patient information, including patient
ID, name, age, and diagnosis. The system should allow adding new patients, displaying
all patient records, and searching for patients by diagnosis. Write a C program using a
structure to store patient information. Include functions to add, display, and search for
patients based on their diagnosis.
12. Implement a calculator that performs basic operations like addition, subtraction,
multiplication, and division. The program should prompt the user to input two numbers
and an operator, then display the result. Create a C program that takes two numbers and
an operator as input, performs the chosen operation, and displays the result. Handle
division by zero error appropriately.
13. A voting system needs to track votes for three candidates. Each vote is represented as a
candidate ID, and the system should tally the votes and declare the winner. Create a C
program that reads votes for each candidate, stores them in an array, tallies the votes, and
declares the winner. Use arrays and loops to implement this functionality.
14. Develop a two-player Tic-Tac-Toe game. The players should take turns entering their
moves on a 3x3 grid, and the program should detect a win, loss, or draw. Write a C
program that allows two players to play Tic-Tac-Toe on a console, using arrays to
represent the board and conditional statements to check for winning combinations.
15. A program is needed to convert temperatures between Celsius, Fahrenheit, and Kelvin.
The user should be able to input a temperature and select the conversion they want to
perform. Implement a C program that takes a temperature and the target scale as input,
performs the appropriate conversion, and displays the result. Include functions for each
conversion type.
16. A restaurant billing system needs to calculate the total bill based on ordered items. Each
item has a price, and the system should calculate the subtotal, add a service tax, and
display the final bill. Write a C program to take ordered item quantities and prices as
input, calculate the subtotal, add tax, and display the total bill. Use arrays to store item
details.
17. A railway reservation system wants to maintain details of seats in each train
compartment. Users should be able to book a seat, cancel a booking, and check seat
availability. Write a C program to simulate a simple seat reservation system using arrays.
Implement functions to book, cancel, and check seat availability.
18. A financial institution needs a loan payment calculator to compute monthly payments for
a given loan amount, annual interest rate, and loan term (in years). Implement a C
program that calculates the monthly payment for a loan using the formula for an
amortized loan. Take loan amount, interest rate, and term as inputs.
19. A university needs to manage a list of students, with each student having a unique ID,
name, and GPA. They want to view the list sorted by GPA or name.Write a C program
that uses a structure to store student records and dynamically allocates memory for the
list of students. Implement functions to sort the students by GPA or name.
20. A software application needs a feature to check if a given string is a palindrome (reads
the same forwards and backwards).Write a C program that checks if an input string is a
palindrome.
21. A math app requires the calculation of factorials and Fibonacci numbers for given input
values. Write a recursive C program to calculate the factorial of a number and another
recursive program to generate the Fibonacci series up to a specified term.
22. A game application needs a maze-solving feature, where a user should find a path from
the starting point to the end in a grid. Implement a C program that uses recursion to solve
a maze. Represent the maze as a 2D array, where '1' indicates a path and '0' indicates a
wall. The program should find a path from the start to the end of the maze.
23. An airline reservation system requires a program to manage flights, with each flight
having a flight number, destination, departure time, and seat availability.Write a C
program using an array of structures to store flight information. Implement functions to
add new flights, search for a flight by flight number, and display available seats for a
selected flight.
24. An attendance system uses bitwise operations to efficiently track daily attendance for
each employee. Each bit represents attendance for a day in a month. Write a C program
that uses bitwise operations to store and manipulate attendance records for a month.
Include functions to mark attendance for a specific day and check attendance for any
given day.
25. A scientific application requires matrix multiplication for data analysis. Given two
matrices, calculate their product. Write a C program that reads two matrices from the
user, multiplies them (if their dimensions allow), and displays the resulting matrix.
26. A registration system needs to validate email addresses based on criteria like the presence
of "@" and "." in the correct positions. Write a C program to validate email addresses
based on specified rules. Use string manipulation functions to check if the input email is
valid or invalid.
27. A school wants to track student attendance for each month. Each bit represents a day,
with 1 for present and 0 for absent. Write a C program using bitwise operations to set,
clear, and check the attendance for each day. Implement functions to mark attendance,
check attendance on a specific day, and count the number of present days.
28. A hospital needs a program to manage patient admissions. Each ward has a limited
number of beds, and the program should track available beds in real-time. Create a C
program to manage bed availability using arrays. Include functions to admit a patient
(decrease bed count), discharge a patient (increase bed count), and view the current bed
status for each ward.
29. A travel agency wants to manage bookings for multiple travel packages. Each package
has limited seats, and customers should be able to book tickets if seats are available.
Write a C program using structures and arrays to manage travel packages. Implement
functions for booking a ticket, canceling a booking, and displaying available seats for
each package.
30. A school needs a program to analyze students’ marks across subjects and calculate the
highest, lowest, and average marks per subject. Implement a C program using arrays to
store marks of students for each subject. Calculate and display the highest, lowest, and
average marks for each subject.
31. A weather station collects daily temperature data and requires a program to calculate the
average, maximum, and minimum temperatures over a week. Create a C program that
reads daily temperature data, stores it in an array, and calculates the average, highest, and
lowest temperatures.
32. An airline wants a program to handle seat reservations on a flight with dynamically
allocated seating based on demand. Write a C program that dynamically allocates a 2D
array representing seats in different classes (e.g., economy, business). Include functions
to reserve, cancel, and view available seats for each class.
33. A restaurant needs a menu system with categories (e.g., appetizers, main course, desserts)
where each category has items and prices. Design a C program with nested loop to
represent the menu. Implement functions to view items by category, add orders, calculate
the total cost, and generate a bill.
34. A weather monitoring system collects temperature, humidity, and pressure data and
requires a program to analyze trends. Write a C program to store and analyze weather
data. Calculate the average, minimum, and maximum for each parameter and detect
significant trend changes over time.
35. A store offers different discounts based on the total purchase amount. Customers get 5%
off for spending over $100, 10% for over $200, and 15% for over $500. Write a C
program that prompts the user for their total purchase amount and uses conditional
statements to calculate the final price after applying the correct discount.
36. A traffic monitoring system assigns fines based on the speed of vehicles. If the speed is
below the limit, there’s no fine. Exceeding the limit incurs a $50 fine, and for speeds 20
mph over, it incurs $100.Implement a C program that takes the speed limit and the
vehicle speed as input, calculates the fine using conditional statements, and displays the
fine amount.
37. A company awards an end-of-year bonus to employees based on their performance
ratings: 10% of their salary for "Excellent," 5% for "Good," and 2% for "Average." Write
a C program that prompts the user for their rating and salary, then uses if-else statements
to calculate and display the bonus.
39. A calendar application needs to identify if a given year is a leap year. Write a C program
that takes a year as input and uses if-else control structures to check if it’s a leap year
(divisible by 4, but not by 100, unless it’s also divisible by 400).
40. A voting system needs to verify if a person is eligible to vote, which requires them to be
at least 18 years old. Write a C program that takes the user's age as input and uses an if-
else statement to determine and display if they are eligible to vote.
41. A school grading system assigns grades based on scores: A for 90+, B for 80-89, C for
70-79, and so forth. Write a C program that takes a student’s score as input, then uses if-
else statements to determine and display the grade.
42. Create a simple game where the program generates a random number, and the user has to
guess it. Write a C program that generates a random number between 1 and 100. Use a
loop to allow the user to keep guessing, providing feedback if their guess is too high or
too low, until they guess correctly.
43. A program needs to count the number of odd and even numbers in a sequence. Write a C
program that takes a series of numbers from the user, counts how many are odd and how
many are even, and displays the counts at the end.
44. A bank wants a simple menu-based program to manage account balances with options for
deposit, withdrawal, and balance check. Implement a C program with a menu to perform
deposit, withdrawal, and balance inquiry operations on a bank account using a switch
statement and a loop for the menu.
45. A shopping cart applies discounts based on the number of items purchased: no discount
for less than 5 items, 5% for 5–10 items, and 10% for more than 10 items. Write a C
program that takes the number of items and the price per item as input, then calculates the
total price with any applicable discount using if-else statements.
46. Implement a simple "Rock, Paper, Scissors" game where a player competes against the
computer. Write a C program that prompts the player to select Rock, Paper, or Scissors,
then randomly chooses one for the computer. Use control structures to determine the
winner and display the result.
47. A fitness tracker app requires users to input their daily calorie intake over a week. Write a
C program that prompts the user to enter their calorie intake for each day of the week,
calculates the average, and displays whether they met their calorie goal (e.g., 2000
calories daily) on average.
48. An electricity provider charges different rates based on usage. For example, the first 100
units cost $0.10 per unit, the next 100 units $0.15, and anything above 200 units
$0.20.Write a C program that takes the number of units used as input and uses if-else
statements to calculate the total bill based on these tiered rates.
49. A digital lock system requires the sum of digits in a given numeric code. Write a C
program that takes an integer as input and uses a loop to calculate and display the sum of
its digits.
50. A travel app needs to convert distances between different units: kilometers, miles, meters,
and feet. Write a C program that takes a distance value and the unit to convert to, then
uses a switch statement to perform the conversion and display the result.
51. A bank needs an ATM simulation where users can withdraw cash, deposit cash, or check
their balance. Implement a menu-driven C program with a balance variable. Use a loop
and switch statement to provide options for withdrawing, depositing, and viewing the
balance.
52. A math program needs to solve quadratic equations in the form ax pow 2+bx+c=Write a
C program that takes coefficients a, b, and c as input and uses conditional statements to
determine the nature of the roots (real and different, real and equal, or complex) and
display the roots.
53. A design tool needs to generate and display specific patterns based on user input. For
instance, a triangle or diamond shape. Write a C program that uses nested loops to print a
triangle or diamond pattern of stars based on the user's specified number of rows.
54. A date entry system needs to verify that a given date is valid, considering leap years and
varying days per month. Write a C program that takes a date (day, month, year) as input
and uses if-else control structures to check if the date is valid, considering leap years and
month lengths.
55. A tax authority has a system where income tax rates depend on income brackets: 0% for
$0–$10,000, 10% for $10,001–$30,000, 20% for $30,001–$60,000, and 30% above
$60,000. Write a C program that takes a user's income as input and uses nested if
statements to calculate the tax amount based on the income brackets.
56. A school awards scholarships based on students’ GPA and extracurricular activities.
Students with a GPA of 3.8 or above and at least two extracurricular activities receive the
full scholarship; those with a GPA of 3.5 or above and one activity receive a partial
scholarship. Implement a C program that takes GPA and activity count as input, and uses
nested if statements to determine if the student qualifies for a full or partial scholarship.
57. A weather app gives clothing suggestions based on temperature and humidity: if the
temperature is above 30°C and humidity is above 70%, it suggests light, breathable
clothing; if the temperature is below 10°C, it suggests warm clothing. Write a C program
that takes temperature and humidity as input and uses nested if statements to provide
clothing suggestions.
58. A job requires applicants to be at least 18 years old, and they must have a high school
diploma if under 25. If the applicant is 25 or older, only work experience is required.
Implement a C program that takes age, education level, and work experience as input,
and uses nested if statements to determine if the applicant is eligible for the job.
59. A hotel charges different rates depending on the season and type of room. If it’s high
season (June–August), room prices are higher, with a 20% increase for luxury rooms and
a 10% increase for standard rooms. Write a C program that takes the season, room type,
and base room rate as input, then uses nested if statements to calculate and display the
final room price.
60. An event has different ticket prices based on age and membership status. Members over
60 get a 50% discount, members under 18 get a 30% discount, while non-members only
get a 10% discount if they’re over 60. Write a C program that takes age, membership
status, and base ticket price as input, and uses nested if statements to determine the final
ticket price.