Unit – 1 : Operators
1. Bank Interest Calculator
You have deposited money in a bank. The bank offers a certain rate of interest per year.
Write a program to calculate how much simple interest you will earn.
Input Format
First line: Principal amount (integer)
Second line: Annual rate of interest (float)
Third line: Time in years (integer)
Output Format
Print the simple interest rounded to 2 decimal places.
Sample Input
5000
4.5
3
Sample Output
Simple Interest = 675.00
2. Park Ticket Checker
The city park charges a different fee for visitors based on whether the visitor count is even or odd.
Write a program to check whether the entered number of visitors is Even or Odd.
Input Format
A single integer (number of visitors)
Output Format
Print Even or Odd.
Sample Input
You have deposited money in a bank. The bank offers a certain rate of interest per year.
Sample Input
11
Sample Output
Odd
3. Unlock Powers
There is a mysterious land of Algoria, an ancient riddle challenged wizards to swap two enchanted
numbers without using a third. Solving this puzzle was said to unlock hidden powers. Help the
young wizard set out to uncover the secret method and prove their mastery.
Input Format :
Read the two numbers.
Output Format :
Print the two numbers as output.
Sample Input
45
Sample Output
54
4. Higher Exam Score – The School Competition
Two friends, Alex and Sam, participated in their school’s annual science quiz.
After the competition, both of them received their individual scores.
The school wants to know who performed better so they can award the “Best Performer” prize.
Write a C program to compare their scores and find out who scored higher using the ternary operator.
Input Format
Two integers separated by a space (First integer = Alex’s score, Second integer = Sam’s score)
Output Format
Print one of the following:
Alex scored higher with <score> if Alex’s score is higher.
Sam scored higher with <score> if Sam’s score is higher.
Both scored the same with <score> if their scores are equal.
Sample Input
78 82
Sample Output
Sam scored higher with 82
5. Secret Code to ASCII – The Detective’s Message
Detective Maya receives a mysterious letter with a single hidden character inside.
To decode the message, she needs to find the ASCII value of that character,
because the number will unlock the next clue in the investigation.
Your task is to help Maya by writing a C program that takes a single character input
and prints its ASCII value.
Input Format
A single character (letter, digit, or symbol)
Output Format
Print the ASCII value of the character.
Sample Input
A
Sample Output
65
6. Magical Bit Operations – The Wizard’s Duel
In the land of Binarya, two wizards—Zorak and Lyra—each possess a magical number.
To determine whose magic is stronger, they perform three ancient binary spells:
AND Spell – Combines their powers but keeps only the common strength.
OR Spell – Merges all their strengths together.
XOR Spell – Creates a new power from only their unique strengths.
Your task is to write a C program that reads both wizards’ numbers and
displays the results of these three spells.
Input Format
Two integers separated by a space
(First integer = Zorak’s number, Second integer = Lyra’s number)
Output Format
Print three lines in the following format:
AND = <value>
OR = <value>
XOR = <value>
6. Magical Bit Operations – The Wizard’s Duel
Sample Input
75
Sample Output
AND = 5
OR = 7
XOR = 2
7. Candy Counter – The Sweet Shop’s Daily Report
Mrs. Lila owns a popular candy shop. Every morning, she records the total number of candies available.
During the day, new candies sometimes arrive, and some candies are sold to customers.
Today, she wants to:
Pre-increment the count to include a fresh candy delivery before recording the total.
Post-decrement the count to show how many candies are left before selling one more.
Finally, display the updated count after the last sale.
Write a C program to help Mrs. Lila keep track of her candy count using increment and decrement
operators.
Input Format
A single integer (initial candy count at the start of the day)
Output Format
Print three lines exactly in the following format:
Pre-increment = <value after adding>
Post-decrement = <value before selling>
After decrement = <value after selling>
7. Candy Counter – The Sweet Shop’s Daily Report
Sample Input
20
Sample Output
Pre-increment = 21
Post-decrement = 21
After decrement = 20
8. Pizza Shop Area – The Chef’s Perfect Pizza
Chef Marco runs a famous pizza shop.
Before baking, he needs to calculate the area of a round pizza to decide how much cheese and sauce
to spread evenly.
He always uses a constant value of π (PI) for his calculations.
Help Chef Marco write a C program that calculates the area of the pizza using the formula:
Use a constant (#define) for π (take PI = 3.14159).
Input Format
A single floating-point number (the radius of the pizza in centimeters)
Output Format
Print the area rounded to two decimal places
Sample Input
7
Sample Output
Area = 153.94
9. Weather Temperature Check – The Mountain Hiker’s Day
Adventurer Riya is hiking in the Himalayas, where the weather changes dramatically.
Every hour, she records the temperature to decide her next move:
If the temperature is positive, it’s warm enough to continue hiking.
If the temperature is negative, it’s freezing and she needs to set up camp.
If the temperature is exactly zero, she will take a rest and wait for it to change.
Write a C program that helps Riya decide by checking whether the temperature is
Positive, Negative, or Zero.
Input Format
A single integer (temperature in °C)
Output Format
Print one of the following: Positive, Negative, Zero
Sample Input
-3
Sample Output
Negative
10. Exam Marks Calculator – The Final Report Card
Student Arjun has just finished his final exams in three subjects:
Math, Science, and English.
The school needs a small program to quickly calculate his total marks and average score so the report
card can be prepared.
Your task is to help Arjun by writing a C program that:
Reads the marks of the three subjects.
Calculates the Total Marks.
Calculates the Average Marks (rounded to 2 decimal places).
Input Format
Three integers separated by a space
(Marks for Math, Science, and English respectively; each out of 100)
Output Format
Print two lines:
Total = <value>
Average = <value rounded to 2 decimals>
10. Exam Marks Calculator – The Final Report Card
Sample Input
85 90 88
Sample Output
Total = 263
Average = 87.67
Unit – 2 : Conditional & Control Statement
1. Movie Ticket Discount
A local cinema celebrates Kids’ Day by giving a 10% discount to customers under 18 years old.
Write a program to calculate the final ticket price after applying the discount if eligible.
Input Format
Two integers:
Ticket price
Age of the customer
Output Format
Final ticket price after discount (if age < 18) or original price.
Sample Input
200 16
Sample Output
Final Price = 180
2. Traffic Camera Counter
A traffic camera counts passing cars until it detects a car with a faulty number plate (marked by a
negative number).
Stop counting immediately when a negative number is entered.
Input Format
A series of integers (each car’s ID, terminate with a negative number)
Output Format
Print total valid cars counted.
Sample Input
45 67 88 -1
Sample Output
Total valid cars = 3
3. Coin Collector
A coin machine counts coins from 1 to N but skips coins that are multiples of 5 because they are
special edition coins sent for inspection.
Write a program to display all coin numbers except those that are multiples of 5.
Input Format
Single integer N
Output Format
All coin numbers except multiples of 5 in one line.
Sample Input
12
Sample Output
1 2 3 4 6 7 8 9 11 12
4. Guess the Secret Number
A game system chooses a secret number (say 7).
The player must keep guessing until they guess correctly.
Use a do-while loop to ensure the game runs at least once.
Input Format
Multiple guesses until correct.
Output Format
For each wrong guess, print: Try again!
When correct, print: Correct!
Sample Input
3
Sample Output
Try Again
5. Fruit Price Calculator
A fruit shop sells:
1: Apple (₹100/kg)
2: Mango (₹80/kg)
3: Banana (₹40/kg)
Write a program that takes the fruit choice and the quantity in kg
and displays the total price. Use a switch statement.
Input Format
Two inputs:
Integer (fruit choice 1–3)
Float (quantity in kg)
Output Format
Print Total = <value> (price rounded to 2 decimals) or Invalid Choice.
5. Fruit Price Calculator
Sample Input
2
1.5
Sample Output
Total = 120.00
6. Amusement Park Ticket Checker
An amusement park charges based on age:
Below 5 years: Free Entry
5 to 12 years: ₹150
13 to 59 years: ₹300
60 years and above: ₹200 (Senior Citizen Discount)
Write a C program to read a person’s age and display the ticket price.
Input Format
Single integer (age)
Output Format
Print Ticket Price = <amount>.
Sample Input
65
Sample Output
Ticket Price = 200
7. Digital Clock Seconds Counter
A digital clock counts seconds starting from 1.
It must stop counting if the seconds reach a given limit N
or if a special number 13 appears (unlucky for the system).
Write a C program that prints the seconds until it reaches N
but stops early if the count hits 13.
Input Format
Single integer N
Output Format
Print the numbers counted (space-separated).
Sample Input
20
Sample Output
1 2 3 4 5 6 7 8 9 10 11 12 13
8. Lucky Draw Number
A lucky draw machine keeps asking the player to enter numbers.
If the number is even, print "Try Again" and continue asking.
If the number is odd, print "You Win!" and stop the game.
Write a C program using a do-while loop.
Input Format
Multiple integers (one per line) until an odd number is entered.
Output Format
For each input, print the result.
Sample Input
8
12
5
Sample Output
Try Again
Try Again
You Win!
9. Step Tracker – Walking Countdown
Nisha sets a daily step goal.
Starting from the total steps she needs to walk,
her tracker counts down to zero as she walks.
Write a program using a while loop to:
Print the step count after each 100 steps completed,
Stop when the steps reach 0.
Input Format
Single integer (total steps, multiple of 100)
Output Format
Print each milestone on a new line.
9. Step Tracker – Walking Countdown
Sample Input
500
Sample Output
Steps left: 500
Steps left: 400
Steps left: 300
Steps left: 200
Steps left: 100
Steps left: 0
10. Power Saver – Monthly Energy Tracker
A family wants to track their electricity usage for N days of a month.
Each day they record the number of units consumed.
The goal is to calculate:
Total units used in the month
Average daily usage
Write a C program using a for loop to:
Read the number of days (N).
Read the units consumed for each day.
Print the total units and average usage (rounded to 2 decimals).
Input Format
First line: Integer N (number of days)
Next N lines: Integer (units consumed for each day)
Output Format
Total = <total units>
Average = <average units>
10. Power Saver – Monthly Energy Tracker
Sample Input
5
12
10
15
13
20
Sample Output
Total = 70
Average = 14.00
Unit – 3 : Arrays & Strings
1. Cricket Score Analyzer
A cricket team played N matches, and you have their scores. Write a program to find the highest score.
Input Format
First line: Integer N (number of matches)
Next N lines: Each line has the team’s score.
Output Format
Print Highest Score = <value>
Sample Input
5
120
98
135
110
90
Sample Output
Highest Score = 135
2. Candy Shop Sales
A candy shop records daily sales for 7 days. Write a program to calculate the total and average candies
sold in the week.
Input Format
7 integers (sales per day)
Output Format
Total = <value>
Average = <value>
Sample Input
10 20 15 18 22 25 30
Sample Output
Total = 140
Average = 20
3. Music Playlist Search
You have a playlist of N songs stored as numbers (IDs).
Write a program to search for a song ID and print whether it is Found or Not Found.
Input Format
First line: Integer N
Next N integers: Song IDs
Last line: Integer (song ID to search)
Output Format
Print Found or Not Found
Sample Input
5
11 22 33 44 55
33
Sample Output
Found
4. Student Marks Table
The principal of Bright Future School wants to prepare a progress report for 3 students.
Each student has marks in 3 subjects: Math, Science, and English.
The school’s computer operator needs a program to quickly calculate
the total marks of each student to decide the class topper.
Write a program to read the marks of all 3 students (in 3 subjects each)
and print the total marks of every student.
Input Format
3 lines, each containing 3 integers (marks per subject for each student)
Output Format
3 lines: Student X Total = <value>
4. Student Marks Table
Sample Input
70 80 90
60 75 85
88 92 79
Sample Output
Student 1 Total = 240
Student 2 Total = 220
Student 3 Total = 259
4. Football Scoreboard
The City League Finals are between Team 1 (Red Hawks) and Team 2 (Blue Sharks).
Both teams play 3 matches in the championship.
The sports committee needs a program to record the goals scored by each team
and announce the winner based on total goals across all matches.
Write a program to input the goals of both teams
and print their total goals along with the winner.
Input Format
2 lines, each with 3 integers (goals per match for each team)
Output Format
Team 1 Total = <value>
Team 2 Total = <value>
Winner = Team X
4. Football Scoreboard
Sample Input
213
124
Sample Output
Team 1 Total = 6
Team 2 Total = 7
Winner = Team 2
5. Password Checker
The City Library is upgrading to an online membership system.
To confirm registration, users must enter their password twice.
If both entries match, the account is created.
If they don’t, the system alerts the user to re-enter the password.
Write a program to compare the two passwords using strcmp()
and display whether they match.
Input Format
Two strings (entered on separate lines)
Output Format
Password Matched or Password Mismatch
Sample Input 1
hello123
hello123
Sample Output 1
Password Matched
6. Song Merger
Two popular singers, Aria and Leo, are performing a duet concert.
The event organizer wants to create a single hashtag by merging both their stage names
to promote the event on social media.
Write a program using strcat() to combine the two names.
Input Format
Two strings (first name, second name)
Output Format
Copied Name = <name>
Sample Input 1
Anurag
Sample Output 1
Copied Name = Anurag
7. Secret Message Reverse
A young detective receives a coded message from an unknown sender.
The clue says the real message is hidden in reverse order.
She needs a program to quickly reverse the given string
to reveal the actual content.
Write a program using strrev() to reverse the message.
Input Format
Single string (word)
Output Format
Reversed = <value>
Sample Input 1
MISSION
Sample Output 1
Reversed = NOISSIM
8. Archery Tournament – Closest to the Target
In a national archery competition, players shoot arrows and record their distance from the target
center in centimeters for each shot.
The tournament judges want a program to find the shot closest to the center (the smallest
distance).
Input Format
First line: Integer N (number of shots)
Next N integers: Distances of each shot from the center.
Output Format
Closest Shot = <smallest distance>
Sample Input 1
6
12 8 15 7 9 11
Sample Output 1
Closest Shot = 7
9. Pizza Orders Tracker – Find Topper of the Day
A pizza shop records the number of pizzas sold by each delivery boy in a day.
The manager wants to know who sold the most pizzas
to award the "Star Seller" badge.
Input Format
First line: Integer N (number of delivery boys)
Next N integers: Number of pizzas sold by each delivery boy.
Output Format
Top Seller = <index> (0-based)
Pizzas Sold = <max value>
Sample Input 1
5
12 18 20 15 20
Sample Output 1
Top Seller = 2
Pizzas Sold = 20
10. Magic Mirror – Reverse the Parade
During the Annual City Parade, floats enter the ground one by one.
The event manager wants to display the order of departure
which will be the exact reverse of the arrival order.
Help the manager by writing a C program to reverse the parade order.
Task
Read the number of floats (N) and their arrival numbers.
Print the reversed order using arrays.
Input Format
First line: Integer N (number of floats)
Second line: N integers (arrival numbers in order)
Output Format
A single line with the departure order (numbers reversed).
10. Magic Mirror – Reverse the Parade
Sample Input 1
6
101 102 103 104 105 106
Sample Output 1
106 105 104 103 102 101
Unit – 5 : Searching & Sorting
1. The Enchanted Calculator
In a forgotten temple lies a calculator that speaks in riddles.
It asks you to bring two numbers and a symbol (+, -, *, /).
Your task is to write a function that performs the operation and returns the result.
Input Format
Two integers separated by space
A character (+, -, *, /) representing the operation
Output Format
Single number (result of the operation)
Sample Input
12 4
*
Sample Output
48
2. The Gatekeeper’s Dilemma
A gatekeeper only allows passage to those with even numbers.
Write a function that returns 1 for even numbers and 0 for odd numbers.
Input Format
Single integer N
Output Format
1 if even, 0 if odd
Sample Input
17
Sample Output
0
3. The Three Guardians
Three ancient stones each have a number.
Write a function to return the largest among them.
Input Format
Three integers separated by space
Output Format
Single integer (largest value)
Sample Input
15 42 28
Sample Output
42
4. The Frozen Spell
A frost mage casts a chilly curse giving a temperature in Celsius.
Write a function that converts it to Fahrenheit:
F = (C × 9/5) + 32
Input Format
Single float (temperature in Celsius)
Output Format
Single float (temperature in Fahrenheit, 2 decimal places)
Sample Input
25
Sample Output
77.00
5. The Summoner’s Riddle
The village elder asks you to summon numbers from 1 to N and find their total sum.
Input Format
Single integer N
Output Format
Single integer (sum of numbers from 1 to N)
Sample Input
10
Sample Output
55
6. The Endless Staircase
To climb the endless staircase, you must know the factorial of your step number.
Input Format
Single integer N (≥ 0)
Output Format
Single integer (N!)
Sample Input
5
Sample Output
120
7. The Fibonacci Forest’s Secret Path
In the forest, the nth clearing’s position is determined by the sum of the two previous clearings.
Write a recursive function to find the nth Fibonacci number.
Input Format
Single integer N (position in Fibonacci sequence, 0-indexed)
Output Format
Single integer (Nth Fibonacci number)
Sample Input
7
Sample Output
13
8. The Digit Summoner’s Code
A cryptic scroll contains a number. To unlock its secret, sum all its digits recursively.
Input Format
Single integer N
Output Format
Single integer (sum of digits)
Sample Input
458
Sample Output
17
9. The Counting Crystal
A magical crystal reveals its power when you count the number of digits recursively.
Input Format
Single integer N
Output Format
Single integer (number of digits)
Sample Input
2025
Sample Output
4
10. The Power of the Ancients
To cast a mighty spell, multiply a base number by itself exponent times recursively.
Input Format
Two integers: Base and Exponent
Output Format
Single integer (Base^Exponent)
Sample Input
34
Sample Output
81
Unit – 4 : Functions and Recursions
1. Library Book Finder
The City Library has a shelf with N books, each with a unique ID number.
A librarian wants a program to search for a book ID requested by a student.
Input Format
First line: Integer N (number of books)
Second line: N integers (book IDs)
Third line: Integer (book ID to search)
Output Format
If found: Book Found at position <index> (0-based)
Else: Book Not Found
Sample Input
5
101 205 309 402 506
309
Sample Output
Book Found at position 2
2. Exam Roll Call
A school keeps a sorted list of student roll numbers.
The office staff wants a program to check whether a student is enrolled.
Input Format
First line: Integer N (number of students)
Second line: N integers in sorted order (roll numbers)
Third line: Integer (roll number to search)
Output Format
If found: Student Found at position <index> (0-based)
Else: Student Not Found
Sample Input
6
1001 1005 1010 1020 1030 1040
1020
Sample Output
Student Found at position 3
3. Candy Sale Sorter
A candy shop tracks daily sales of different candies.
The manager wants to sort the sales in ascending order to prepare a report.
Input Format
First line: Integer N (number of candies)
Second line: N integers (sales numbers)
Output Format
Sorted Sales: <values separated by space>
Sample Input
5
25 10 30 15 20
Sample Output
Sorted Sales: 10 15 20 25 30
4. Package Weights
A courier company wants to sort packages by weight for efficient loading.
Use Insertion Sort to arrange weights in ascending order.
Input Format
First line: Integer N (number of packages)
Second line: N integers (weights)
Output Format
Sorted Weights: <ascending order>
Sample Input
6
12 5 8 15 3 10
Sample Output
Sorted Weights: 3 5 8 10 12 15
5. Paint Shades
An artist has N color shades with brightness values.
She wants to sort them from dimmest to brightest using Selection Sort.
Input Format
First line: Integer N (number of shades)
Second line: N integers (brightness values)
Output Format
Sorted Shades: <ascending order>
Sample Input
4
80 60 90 70
Sample Output
Sorted Shades: 60 70 80 90
6. Racing Scores
In a racing tournament, each car is given a score based on lap performance.
Use Quick Sort to sort the scores from lowest to highest.
Input Format
First line: Integer N (number of cars)
Second line: N integers (scores)
Output Format
Sorted Scores: <ascending order>
Sample Input
5
55 40 65 50 60
Sample Output
Sorted Scores: 40 50 55 60 65
7. Student Marks Merge
A school has two classes, each with sorted marks of students. To create a combined rank list, use
Merge Sort to sort all marks together.
Input Format
First line: Integer N (size of class 1)
Second line: N integers (sorted marks of class 1)
Third line: Integer M (size of class 2)
Fourth line: M integers (sorted marks of class 2)
Output Format Combined Sorted Marks: <ascending order>
Sample Input
3
45 55 65
4
50 60 70 80
Sample Output
Combined Sorted Marks: 45 50 55 60 65 70 80
8. Birthday Reminder
A school secretary has a list of student birthdays stored as day numbers (1–31).
She wants a program to find all students who have a birthday on a particular day.
Input Format
First line: Integer N (number of students)
Second line: N integers (birthdays)
Third line: Integer D (day to search)
Output Format
If found: Birthday found at positions: <indexes> (0-based, space-separated)
If not found: No birthdays on this day
Sample Input
7
5 12 5 23 5 18 12
5
Sample Output
Birthday found at positions: 0 2 4
8. Birthday Reminder
A school secretary has a list of student birthdays stored as day numbers (1–31).
She wants a program to find all students who have a birthday on a particular day.
Input Format
First line: Integer N (number of students)
Second line: N integers (birthdays)
Third line: Integer D (day to search)
Output Format
If found: Birthday found at positions: <indexes> (0-based, space-separated)
If not found: No birthdays on this day
Sample Input
7
5 12 5 23 5 18 12
5
Sample Output
Birthday found at positions: 0 2 4
9. Basketball Scores Ranking
A basketball coach records scores of 8 players in a practice match.
He wants to:
Sort the scores in ascending order using Bubble Sort,
Identify the highest and lowest scorers.
Input Format
First line: Integer N (number of players)
Second line: N integers (scores)
Output Format
Sorted Scores: <ascending order>
Highest Score = <value>
Lowest Score = <value>
9. Basketball Scores Ranking
Sample Input
8
12 25 18 30 20 15 28 22
Sample Output
Sorted Scores: 12 15 18 20 22 25 28 30
Highest Score = 30
Lowest Score = 12
10. Marathon Finish Time Checker
A marathon event has N runners, and their finish times (in minutes) are recorded in sorted order.
The organizer wants a program to check if a particular runner finished in a specific time using
Binary Search.
Input Format
First line: Integer N (number of runners)
Second line: N integers (finish times in sorted order)
Third line: Integer T (finish time to search)
Output Format
If found: Runner finished in <T> minutes; If not found: No runner with finish time <T>
Sample Input
7
180 185 190 195 200 205 210
195
Sample Output
Runner finished in 195 minutes