0% found this document useful (0 votes)
23 views3 pages

Problem Set 05

The document provides instructions for a programming assignment with 3 questions. Students are asked to write C programs to analyze student grades and calculate prices based on product codes. The programs must be compiled and submitted as a single zip file by the deadline following specific naming conventions.

Uploaded by

nandeepmtr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Problem Set 05

The document provides instructions for a programming assignment with 3 questions. Students are asked to write C programs to analyze student grades and calculate prices based on product codes. The programs must be compiled and submitted as a single zip file by the deadline following specific naming conventions.

Uploaded by

nandeepmtr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

National Institute of Technology Calicut

Department of Computer Science and Engineering


B. Tech. (CSE) – First Semester
CS1091E: Programming Laboratory
Problem Set – 5

Submission deadline (on or before):


• 26/09/23, 5:00 PM
Policies for Submission and Evaluation:
• You must submit your programs in the moodle (Eduserver) course page,
on or before the submission deadline. Also, ensure that your programs
compile and execute without errors in the linux platform. During evalu-
ation, failure to execute programs without compilation errors may lead
to zero marks for that program. Detection of ANY malpractice can
lead to awarding an F grade in the course.

Naming Conventions for Individual Program


• P S < P ROBLEM SET N U M BER > < ROLLN O > <
F IRST − N AM E > < P ROGRAM − N U M BER > . <
extension > (For example: P S05 BxxyyyyCS LAXM AN 1.c).
Please make sure that you follow the naming conventions correctly.

Naming Conventions for Submission


• Submit a single ZIP (.zip) file (do not submit in any other archived
formats like .rar, .tar, .gz) containing the source code (.c file)
for the three programs. The name of this file must be P S <
P ROBLEM SET N U M BER > < ROLLN O > < F IRST −
N AM E > .zip (For example: P S05 BxxyyyyCS LAXM AN.zip).
DO NOT add any other files (like temporary files, input files, etc.)
except your source code, into the zip archive.

Standard of Conduct
• Violations of academic integrity will be severely penalized. Each student
is expected to adhere to high standards of ethical conduct, especially those
related to cheating and plagiarism. Any submitted work MUST BE an
individual effort. Any academic dishonesty will result in zero marks in the
corresponding exam or evaluation and will be reported to the department
council for record keeping and for permission to assign F grade in the
course.
General Instructions
• Programs should be written in C language and compiled using C compiler
in Linux platform. Sample inputs are just indicative. Submit the so-
lutions to questions 1, 2, and 3 as a single .zip file through the
submission link in Eduserver.

1
QUESTIONS
1. Write a C program that reads the marks (int type) of n (n>0 is an inte-
ger) students and assigns a character grade for each student based on the
grading criteria given below:

80 -100 : A

60-79 : B

50-59 : P

0-49 : F

The program should print for each grade, the number of students who
scored that particular grade. The value of n is entered by the user. Use
for loop for iteration and nested if-else and logical operators for deciding
the grade.
Sample input and output:
• Input:
Enter the number of students = 3
Marks of Student 1 = 89
Marks of Student 2 = 91
Marks of Student 3 = 55
• Output:
The total number of students with A grade = 2
The total number of students with B grade = 0
The total number of students with P grade = 1
The total number of students with F grade = 0
2. Change program 1 to accommodate the following. The number of stu-
dents is not given. Rather, the termination of input (students’ marks)
is indicated by -1. Use do-while loop for this program but do not use
break statement.

Sample input and output:


• Input:
Marks of Student 1 = 82
Marks of Student 2 = 58
Marks of Student 3 = 21
Marks of Student 4 = 53
Marks of Student 5 = 65
Marks of Student 6 = -1

2
• Output:
The total number of students with A grade = 1
The total number of students with B grade = 1
The total number of students with P grade = 2
The total number of students with F grade = 1
3. Write a C program to compute the total price for a list of products sold.
Use while loop. Enter product code 0 to terminate iteration(use break
statement). The price per unit is to be determined using a switch state-
ment based on the following table:

Product code Unit price


1 10
2 15
3 5
4 3
5 12

If the code entered is not valid (not in the range 1-5), the program should
print an appropriate message and continue iteration (use continue state-
ment). This checking, and checking for end of input should be done before
entering the switch statement.

Sample input and output:


• Input :
Enter product code between 1 to 5. To terminate enter 0 = 2
Quantity = 11.7
Enter product code between 1 to 5. To terminate enter 0 = 9
Please enter a valid product code.
Enter product code between 1 to 5. To terminate enter 0 = 4
Quantity = 6.92
Enter product code between 1 to 5. To terminate enter 0 = 3
Quantity = 3.89
Enter product code between 1 to 5. To terminate enter 0 = 0
• Output:

Product code Unit price Quantity Price


2 15 11.700000 175.500000
4 3 6.920000 20.760000
3 5 3.890000 19.450000

Total Price = 215.710000

You might also like