bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit efce3fea644047742d19849301e32027b089134c
parent 3d2cb6ab5627752a0f03cc435e63c7a72a14e1f5
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Tue, 28 Oct 2025 15:59:06 +0530

new 43

Diffstat:
Aletusc/luc043.c | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+), 0 deletions(-)

diff --git a/letusc/luc043.c b/letusc/luc043.c @@ -0,0 +1,62 @@ +/* Write a program to find the grace marks for a student using switch. +The user should enter the class obtained by the student and the +number of subjects he has failed in. Use the following logic. + - If the student gets first class and he fails in more than 3 + subjects, he does not get any grace, Otherwise, he gets a grace + of 5 marks per subject. + - If the student gets second class and he fails in more than 2 + subjects, he does not get any grace. Otherwise, he gets a grace + of 4 marks per subject. + - If the student gets third class and he fails in more than 1 + subject, then he does not get any grace. Otherwise, he gets a + grace of 5 marks. +*/ +/* Author - Amit Dutta, Date - 28th OCT, 2025 */ +/* Let Us C, Chap- 6, Page - 106, Qn No.: B(i) */ + +#include <stdio.h> + +int main() +{ + int studentClass, failedSubjectCount, graceMarks = 0; + printf("Class obtained by the student (Enter 1 for First Class, 2 for Second Class, 3 for Third Class): "); + scanf("%d", &studentClass); + printf("Failed Subject Count: "); + scanf("%d", &failedSubjectCount); + + if (failedSubjectCount < 0) { + printf("\nFailed subject count cannot be negative."); + return 1; + } + + switch (studentClass) + { + case 1: + if (failedSubjectCount <= 3) + { + graceMarks += 5 * failedSubjectCount; + } + break; + + case 2: + if (failedSubjectCount <= 2) + { + graceMarks += 4 * failedSubjectCount; + } + break; + + case 3: + if (failedSubjectCount <= 1) + { + graceMarks += 5 * failedSubjectCount; + } + break; + + default: + printf("\nWrong Choice."); + return 1; + } + + printf("\nStudent will get %d grace marks.", graceMarks); + return 0; +}+ \ No newline at end of file
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror