0% found this document useful (0 votes)
2 views8 pages

C Programs

The document outlines a series of programming problems focused on developing algorithms and applications for various tasks, including an expense tracker, to-do list, student performance analysis, e-commerce cart system, mobile phone usage analysis, skill data input, income data processing, and a basic calculator. Each problem includes specific requirements such as input validation, categorization, and the use of control structures without arrays. The problems are designed to enhance programming skills and understanding of algorithms in a structured manner.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

C Programs

The document outlines a series of programming problems focused on developing algorithms and applications for various tasks, including an expense tracker, to-do list, student performance analysis, e-commerce cart system, mobile phone usage analysis, skill data input, income data processing, and a basic calculator. Each problem includes specific requirements such as input validation, categorization, and the use of control structures without arrays. The problems are designed to enhance programming skills and understanding of algorithms in a structured manner.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PIC TAs Assessment – September-2025

Module 1

Problem 1:

a)
Implement a simple expense tracker that allows a user to enter their daily
expenses.
i) Use a while loop to continuously prompt the user to enter an expense amount
until the user chooses to stop.
ii) Keep a running total of the expenses by adding each new expense to the total.
iii) Count the number of expenses entered using a counter variable.
iv) Allow the user to exit the program by entering a specific keyword (e.g.,
"exit").
Develop an algorithm to implement the basic expense tracker without using arrays.
b)
Enhance the expense tracker to categorize expenses (e.g., food, transport,
entertainment) without using arrays.
i) Use separate variables to keep track of totals for each category.
ii) Use a switch statement to assign each expense to a specific category based on
user input.
iii) Display the total expenses for each category and the overall total.
iv) Ensure all entered expenses are valid numbers.
Develop a program to categorize expenses using separate variables for each category
and provide a detailed summary at the end.
c)
Further improve the expense tracker to handle expenses over multiple days
without using arrays.
i) Use variables to store daily totals and a cumulative monthly total.
ii) Prompt the user to enter expenses for different days and update the totals.
iii) Provide an option to view daily and cumulative monthly summaries.
iv) Implement input validation to ensure valid expense entries.
Develop a program that expands your expense tracker to handle multiple days and
provide detailed summaries without using arrays.

Problem 2

a) Given a positive integer greater than 1, develop an algorithm to perform the


following.
i) Print all the factors of the number
ii) Count the number of factors
iii) Among the factors of the number, count the number of even factors.
b) Prime numbers are natural numbers that are greater than 1 and have only two factors
namely 1 and itself. For example 2, 3, 5, 7 and 11 are prime numbers. Develop an
algorithm that verifies whether a given positive integer is a prime number or not. Use
this algorithm to develop a program that prints the first 10 prime numbers.
c) In mathematics, a semiprime is a natural number that is the product of exactly two
prime numbers. The two primes in the product may equal each other, so the
semiprimes include the squares of prime numbers.
For example, the following is a list of semiprime numbers less than 100.
4, 6, 9, 10, 14, 15, 21, 22, 25, 26, 33, 34, 35, 38, 39, 46, 49, 51, 55, 57, 58, 62, 65, 69,
74, 77, 82, 85, 86, 87, 91, 93, 94, and 95. Develop an algorithm to check whether an
integer is semiprime. Develop a program that prints all semiprime numbers less than
100.

Problem 3

a) Create a basic to-do list application that allows a user to manage tasks
without using arrays.

i) Use a loop to allow the user to add tasks, using a series of individual task
variables (e.g., task1, task2).
ii) Display the tasks by printing each variable.
iii) Allow the user to mark a task as complete using a unique identifier (e.g., task
number).
iv) Provide an option to exit the program.
Develop a program to implement the basic to-do list application without using
arrays.

b) Enhance the to-do list application to prioritize tasks without using arrays.
i) Use separate variables for high, medium, and low priority tasks.
ii) Display tasks grouped by priority.
iii) Allow the user to update the priority of a task by moving it to a different priority
variable.
iv) Provide an option to view tasks sorted by priority.
Develop a program to modify your to-do list application to handle task prioritization
without using arrays.
c) Improve the application by adding due dates for tasks without using arrays.
i) Use variables to store the due date for each task.
ii) Display tasks in order of their due dates.
iii) Provide alerts for tasks that are due soon or overdue.
iv) Allow the user to update or change the due date of a task.
Develop a program to enhance your to-do list application to include due dates and
notifications without using arrays.

Problem 4
a) Switch statements are used to select one group of statements from many available
groups. Given an integer number in the range from 1 to 9, develop a program to print
its words equivalent. For example, if the number is 9, should print as nine. If the
number is -5, it should print it as negative five. Use switch statement with the case
labels ranging from 1 to 9.
b) Given money in rupees, develop a from a program to print its words equivalent. For
example Rs.123, should be printed as Rupees One Two Three.
c) Given money in rupees, develop a program to print its words equivalent as given
below.
Rs.123 should be printed as Rupees One hundred twenty three only.
Rs.56789 should be printed as Rupees Fifty six thousand seven hundred eighty
nine only.

Problem 5

a) Develop an algorithm that processes the results of students as prescribed below.


i) Input the marks for three students in three subjects: Maths, Physics, and
Chemistry.
ii) Calculate and print the total marks and percentage for each student.
iii) Determine and print whether each student has passed or failed the semester
examination based on the following criteria:

For each student:

 Check if the marks in each subject (Maths, Physics, Chemistry) are greater
than or equal to 40.
 Check if the total marks are greater than or equal to 150.
 If both conditions are met, print "Pass", Otherwise, print "Fail".
b) Develop a program to grade the students and do a performance analysis as
specified below.
i) Modify the algorithm to assign letter grades (A, B, C, D, F) for each subject
based on the following criteria:
 A: 90 – 100
 B: 75 – 89
 C: 60 – 74
 D: 40 – 59
 F: Below 40
Print the letter grades for each student in all three subjects.
ii) Add functionality to determine and print the student with the highest total
marks and the student with the lowest total marks.
iii) Calculate and print the average marks for each subject across all students.
Identify and print the highest and lowest marks for each subject.
c) Develop a program to perform advanced student performance analytics as given
below.
i) Develop an algorithm to rank the students based on their total marks and
display their ranks.
ii) Add a feature to calculate and print the percentage of students who passed the
semester. Calculate and display the number of students who passed each
individual subject.
iii) Implement a function to allow the user to input corrected marks for a student
and recalculate the total, percentage, grades, and result based on the new
marks.
Problem 6
a)
Implement a basic e-commerce cart system that allows users to manage items
without using arrays.
i) Use individual variables for each item (e.g., item1_price, item2_price).
ii) Use a loop to allow the user to add or remove items to/from the cart.
iii) Display the total number of items and the combined cost.
iv) Allow the user to exit the program.
Develop an algorithm to implement the basic cart system.
b)
Enhance the cart system to handle discounts without using arrays.
i) Use variables to apply specific discounts for individual items.
ii) Calculate and display the total after applying the discounts.
iii) Allow the user to enter and remove discount codes.
iv) Display the total savings from discounts.
Develop a program to modify your cart system to handle discount codes without using
arrays.

c)
Improve the cart system to check inventory without using arrays.
i) Use variables to track available stock for each item.
ii) Prevent adding items to the cart if stock is unavailable.
iii) Update inventory dynamically as items are added or removed.
iv) Notify the user when inventory levels are low.
Develop a program to expand your cart system to manage inventory without using
arrays.

Problem 7
a) Develop an algorithm that collects the basic mobile phone usage data and does
an analysis as described below.
i) Develop a code snippet that accepts mobile phone usage data (in hours) for
three individuals for one week (7 days).
Use individual variables for each person's daily usage (e.g.,
usage_person1_day1, usage_person1_day2, …, usage_person3_day7).
ii) Calculate the total mobile phone usage for each person over the week by
summing their daily usage.
iii) Calculate the average daily mobile phone usage for each individual over the
week and print it.
iv) Determine and print the person with the maximum and minimum total weekly
usage, along with their values.
b) Develop a program that does an advanced mobile phone usage analysis as
described below.
i) Classify each person as a "Light User" (less than 2 hours/day), "Moderate
User" (2-4 hours/day), or "Heavy User" (more than 4 hours/day) based on
their average daily usage.
ii) Determine and print the day of the week with the highest and lowest mobile
phone usage for each individual.
iii) Assume each person uses their phone for three main activities: social media
(50% of total time), entertainment (30%), and productivity (20%). Calculate
and print the total time spent on each activity for each person.
iv) Print a summary that includes each person’s total weekly usage, average daily
usage, usage classification, and time spent on each activity.

c) Develop a program that does a comparative usage analysis as described below.


i) Analyze each individual's usage trend over the week. Determine if usage is
increasing, decreasing, or fluctuating. Print the result for each person.
ii) Find and print the longest streak of continuous high usage days (more than 4
hours per day) and low usage days (less than 2 hours per day) for each
individual.
iii) Based on the usage patterns, provide recommendations for reducing screen
time or improving productivity (e.g., reducing time on social media, increasing
time on productive activities).
iv) Use a simple linear trend analysis to predict each person’s average daily usage
for the next week based on their current usage patterns.
i) Simulate the impact of implementing a usage reduction strategy (e.g., reducing
social media usage by 30%) on each person's total weekly usage. Calculate
and print the new usage values and compare them with the original values.
ii) Assume a new digital wellbeing policy is introduced, recommending a
maximum of 2 hours of phone usage per day. Evaluate each person's current
usage against the policy. Calculate and print the percentage reduction needed
for each person to comply with the policy.

Problem 8
a) Develop an algorithm that does basic skill data input and analysis as described
below.
i) Read input for skill levels (on a scale of 1 to 5) for three IT employees in three
core domains: Programming, Database Management, and Networking.

Use individual variables for each employee's skills in each domain (e.g.,
skill_emp1_programming, skill_emp1_database, skill_emp1_networking, etc.).

ii) Calculate the total skill score for each employee by summing their skill levels
across all three domains.
iii) Calculate the average skill level across all three employees for each domain and
print the result.
iv) Determine and print the employee with the highest and lowest total skill scores,
along with their respective values.
b) Develop a program does an advanced skill analysis as specified below.
i) Classify each employee as "Beginner" (total skill score 3-6), "Intermediate"
(total skill score 7-9), "Advanced" (total skill score 10-12), or "Expert" (total
skill score 13-15) based on their total skill scores.
ii) Determine the domain in which each employee has the lowest skill level and
print the results.
iii) For each employee, recommend training programs or courses to improve their
skills in their weakest domain.
iv) Print a summary that shows the number of employees in each skill level
category (Beginner, Intermediate, Advanced, Expert).
c) Develop a program that does the comparative skill analysis and recommend an
employee development program as described below.
i) Allow input of previous year's skill levels for each employee in the three
domains and calculate the improvement or decline in their skill scores. Print
the employee with the most improvement and the employee with the most
decline.
ii) Identify employees who are "high-potential" (those who have improved by at
least 2 points in total skill score over the last year). Print the names of these
high-potential employees.
iii) Determine which employees meet the criteria for promotion to a higher skill
level (e.g., from Intermediate to Advanced or Advanced to Expert).Print the
names of employees eligible for promotion.
iv) Develop a customized training plan for each employee based on their weakest
skills and potential for growth. Print the training plan for each employee.

Problem 9
a) Develop an algorithm that processes the basic income data and analyse as
specified below.
i) Read the monthly income data (in INR) for three individuals. Use individual
variables for each person (e.g., income_person1, income_person2,
income_person3) to store the monthly income data.
ii) Calculate the total annual income for each person by multiplying their
monthly income by 12.
iii) Calculate the average monthly income for all three individuals combined and
print it.
iv) Determine and print the person with the highest and lowest annual income,
along with their respective values.
b) Develop a program that does an advanced income analysis as described below.
i) Classify each person's annual income into different tax brackets (e.g., 0–2.5
lakh: No tax, 2.5–5 lakh: 5%, 5–10 lakh: 20%, above 10 lakh: 30%). Print the
tax bracket for each person.
ii) Calculate the tax amount each person needs to pay based on their tax bracket
and print it.
iii) Identify and print the names of individuals who fall into the "No tax" bracket.
iv) Print a summary that shows the number of people in each tax bracket.
c) Develop a program that does comparative income analysis and provide some
insights as described below.
i) Allow input of last year's income for each person and calculate the income
growth percentage for each person this year. Print the person with the highest
growth rate and the lowest growth rate.
ii) Calculate and print the Gini coefficient to measure income inequality among
the three individuals.
iii) Determine whether incomes are generally increasing, decreasing, or stable by
comparing this year’s income with last year’s data.
iv) Based on the income analysis, provide a recommendation for each person to
improve their income (e.g., suggest higher savings, investments, skill
development, etc.).

Problem 10

a) It is known that, a switch statement can be used to select one group of statements
from available many groups of statements. Implement a basic calculator in C that
performs addition, subtraction, multiplication, and division.
i) Allow the user to input two numbers.
ii) Perform the chosen arithmetic operation.
iii) Display the result of the calculation.
iv) Provide an option to exit the program.
Develop a menu driven program to implement the basic calculator.

b)
Improve the previous program to enhance the calculator to perform continuous
operations.
i) Allow the user to use the result of the previous calculation as the first operand.
ii) Display the updated result after each operation.
iii) Allow the user to reset the calculator.
iv) Provide an option to exit the program at any time.
Develop a program that updates your calculator to handle continuous operations.
c)
Develop a program that retains all the features of the previous program and improves
the calculator by adding a memory function.
i) Allow the user to store a value in memory.
ii) Retrieve the stored value for future calculations.
iii) Display the current memory value.
iv) Provide an option to clear the memory.

You might also like