commit 413427c7260a310ab1974278dc4d72f8b419571d
parent efce3fea644047742d19849301e32027b089134c
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Tue, 28 Oct 2025 17:51:12 +0530
nre
Diffstat:
2 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/docs/index.html b/docs/index.html
@@ -720,7 +720,7 @@ int main()
<div class="flex items-center">
<svg class="w-6 h-6 text-blue-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg>
<span class="font-medium text-gray-800">letusc</span>
- <span class="ml-2 text-sm text-gray-500">(57 files)</span>
+ <span class="ml-2 text-sm text-gray-500">(58 files)</span>
</div>
<div class="flex items-center space-x-4">
<a href="https://github.com/notamitgamer/bsc/tree/main/letusc" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub">
@@ -3017,6 +3017,83 @@ int main()
<li>
<div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
<svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
+ <span class="text-gray-700">luc043.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/letusc/luc043.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
+ <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg>
+ </a>
+ <button onclick="showCode('code-letusc-luc043_c', 'luc043.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-letusc-luc043_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/letusc/luc043.c">
+ <pre><code class="language-c">/* 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- 7, Page - 125, Qn No.: C */
+
+#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;
+}</code></pre>
+ </div>
+ </li>
+
+ <li>
+ <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200">
+ <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg>
<span class="text-gray-700">lucproblem001.c</span>
<div class="ml-auto flex items-center space-x-4">
<a href="https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub">
diff --git a/letusc/luc043.c b/letusc/luc043.c
@@ -12,7 +12,7 @@ number of subjects he has failed in. Use the following logic.
grace of 5 marks.
*/
/* Author - Amit Dutta, Date - 28th OCT, 2025 */
-/* Let Us C, Chap- 6, Page - 106, Qn No.: B(i) */
+/* Let Us C, Chap- 7, Page - 125, Qn No.: C */
#include <stdio.h>