commit 6e1d9a8518fe45cafd8d352bce801b13cf2dd9b5
parent 14d85d6e11525d742e920381fe81e532d44f81a5
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Wed, 5 Nov 2025 21:28:42 +0530
new -05112025 _KI002
Diffstat:
12 files changed, 47 insertions(+), 2789 deletions(-)
diff --git a/docs/index.html b/docs/index.html
@@ -658,7 +658,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">khurapati-idea</span>
- <span class="ml-2 text-sm text-gray-500">(1 files)</span>
+ <span class="ml-2 text-sm text-gray-500">(2 files)</span>
</div>
<div class="flex items-center space-x-4">
<a href="https://github.com/notamitgamer/bsc/tree/main/khurapati-idea" 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">
@@ -710,6 +710,36 @@ int main()
}</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">KI002.c</span>
+ <div class="ml-auto flex items-center space-x-4">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI002.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-khurapati-idea-KI002_c', 'KI002.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button>
+ </div>
+ </div>
+ <div id="code-khurapati-idea-KI002_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/khurapati-idea/KI002.c">
+ <pre><code class="language-c">/* Author - Amit Dutta, Date - 05th November, 2025 */
+
+/* Plan - checking for edge case */
+
+#include <stdio.h>
+int main()
+{
+ printf("Starting.....\n");
+
+ for (int i = 1; ; i++)
+ {
+ printf("i = %d\n", i);
+ }
+ return 0;
+}</code></pre>
+ </div>
+ </li>
</ul>
</div>
</li>
diff --git a/khurapati-idea/KI002.c b/khurapati-idea/KI002.c
@@ -0,0 +1,15 @@
+/* Author - Amit Dutta, Date - 05th November, 2025 */
+
+/* Plan - checking for edge case */
+
+#include <stdio.h>
+int main()
+{
+ printf("Starting.....\n");
+
+ for (int i = 1; ; i++)
+ {
+ printf("i = %d\n", i);
+ }
+ return 0;
+}+
\ No newline at end of file
diff --git a/print/print-apc.pdf b/print/print-apc.pdf
Binary files differ.
diff --git a/print/print-apc.txt b/print/print-apc.txt
@@ -1,215 +0,0 @@
-// File: tuition-c/APC-S-001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-001.c
-
-#include<stdio.h>
-int main() {
- int a = 9, b = 4, c;
- c = a + b;
- printf("A + B = %d\n", c);
- c = a / b;
- printf("A / B = %d\n", c);
- c = a % b;
- printf("A %% B = %d\n", c);
- return 0;
-}
-
-/* --- End of tuition-c/APC-S-001.c --- */
-
-// File: tuition-c/APC-S-002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-002.c
-
-#include<stdio.h>
-int main() {
- int a = 5, b = 5, c = 10;
- printf("a = b = %d\n", a == b);
- printf("a > b = %d\n", a > b);
- printf("a < b = %d\n", a < b);
- return 0;
-}
-
-/* --- End of tuition-c/APC-S-002.c --- */
-
-// File: tuition-c/APC-S-003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-S-003.c
-
-#include <stdio.h>
-int main() {
- int a = 5, b = 5, c = 10, result;
-
- result = (a == b) && (c > b);
- printf("Result is %d\n", result);
-
- result = (a == b) && (c < b);
- printf("Result is %d\n", result);
-
- result = (a != b) || (c < b);
- printf("Result is %d\n", result);
-
- result = (a != b) || (c < b);
- printf("Result is %d\n", result);
-
- result = !(a != b);
- printf("Result is %d\n", result);
-
- result = !(a == b);
- printf("Result is %d\n", result);
-
- return 0;
-}
-
-/* --- End of tuition-c/APC-S-003.c --- */
-
-// File: tuition-c/APC-SPS-001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-001.c
-
-// WAP to perform arithmatic operation on integer data
-
-#include<stdio.h>
-int main() {
- int a, b, sum, sub, multi, div, mod;
- printf("Enter 1st number : ");
- scanf("%d", &a);
- printf("Enter 2nd number : ");
- scanf("%d", &b);
- sum = a + b;
- sub = a - b;
- multi = a * b;
- div = a / b;
- mod = a % b;
- printf("\nSum = %d", sum);
- printf("\nSubtraction = %d", sub);
- printf("\nMultiplication = %d", multi);
- printf("\nDivision = %d", div);
- printf("\nModulas = %d", div);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-001.c --- */
-
-// File: tuition-c/APC-SPS-002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-002.c
-
-/* WAP to swap two integers. Display both numbers
-before and after swap */
-
-#include<stdio.h>
-int main() {
- int a = 10, b = 20, temp;
- printf("Before swap A : %d, B : %d", a, b);
- temp = a;
- a = b;
- b = temp;
- printf("\nAfter swap A : %d, B : %d", a, b);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-002.c --- */
-
-// File: tuition-c/APC-SPS-003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-003.c
-
-/* Bitwise AND '&' */
-
-#include<stdio.h>
-int main() {
- unsigned int a = 4, b = 5, c = 6;
- unsigned int x, y;
- x = a & b;
- y = b & c;
- printf("x = %u y = %u", x, y);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-003.c --- */
-
-// File: tuition-c/APC-SPS-004.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-004.c
-
-#include<stdio.h>
-int main() {
- int x = 25, y = 19, z;
- z = x - y;
- z = z & x ;
- printf("Z = %d", z);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-004.c --- */
-
-// File: tuition-c/APC-SPS-005.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-005.c
-
-/* Bitwise OR '|' */
-
-#include<stdio.h>
-int main() {
- int x = 12, y = 14, z = 10, res;
- x++;
- z++;
- x = x + y + z;
- res = x | y;
- z = res | z;
- printf("x = %d y = %d z = %d res = %d", x, y, z, res);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-005.c --- */
-
-// File: tuition-c/APC-SPS-006.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-006.c
-
-/* Bitwise NOT '~' */
-
-#include<stdio.h>
-int main() {
- int x = 12, y = 15, z = 21;
- int res, res1, res2;
- res = x > 10;
- res1 = ~res;
- res2 = ~x;
- printf("REs = %d, Res1 = %d, Res2 = %d", res, res1, res2);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-006.c --- */
-
-// File: tuition-c/APC-SPS-007.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-007.c
-
-/* WAP to check a number is even or odd using bitwise operator */
-
-#include<stdio.h>
-int main() {
- int x, res = 1;
- printf("Enter a number : ");
- scanf("%d", &x);
- res = res & x;
- if (res == 0) {
- printf("\nInput %d is a even number.", x);
- }
- else {
- printf("\nInput %d is a odd number.", x);
- }
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-007.c --- */
-
-// File: tuition-c/APC-SPS-008.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-SPS-008.c
-
-/* WAP to calculate area of circle by accepting radius as input */
-/* Author : Amit Dutta, Date : 15th September, 2025 */
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double r, area;
- printf("Enter the radius of circle : ");
- scanf("%lf", &r);
- area = M_PI * r * r;
- printf("\nArea : %lf", area);
- return 0;
-}
-
-/* --- End of tuition-c/APC-SPS-008.c --- */-
\ No newline at end of file
diff --git a/print/print-letusc.pdf b/print/print-letusc.pdf
Binary files differ.
diff --git a/print/print-letusc.txt b/print/print-letusc.txt
@@ -1,1376 +0,0 @@
-// This file contains all C source code files from letusc/ and tuition-c/ directories
-// Generated by GitHub Copilot
-
-
-// File: letusc/luc001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc001.c
-
-/* Temperature of a city in fahrenheit degrees is input through
-the keyboard. WAP to convert this temperature into Centigrade
-degrees. */
-/* Author - Amit Dutta, Date - 13 sep, 2025 */
-/* Chapter 1; Page 19; Question NO.: F(a) */
-
-#include<stdio.h>
-int main() {
- float f, c;
- printf("Enter the temperature of city in Fahrenheit : ");
- scanf("%f", &f);
- // formula (F - 32) 5/9
- c = ((f - 32) * 5) / 9;
- printf("\nTemperature in centigrade : %f", c);
- return 0;
-}
-
-/* --- End of letusc/luc001.c --- */
-
-// File: letusc/luc002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc002.c
-
-/* The length and breadth of a rectangle and radius of a circle
-are input through the keyboard. Write a program to calculate the
-area and perimeter of the rectangle, and the area and circumference
-of the circle. */
-/* Author - Amit Dutta, Date - 16th SEP, 2025 */
-/* Let Us C; Page - 19; Chap- 1; QNo.: F(b) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double len, bre, r, area_r, per, area_c, cir;
- printf("Enter the length and breadth of the rectangle : ");
- scanf("%lf %lf", &len, &bre);
- printf("Enter the Radius of the circle : ");
- scanf("%lf", &r);
- area_r = len * bre;
- per = 2 * (len + bre);
- area_c = M_PI * r * r;
- cir = 2 * M_PI * r;
- printf("\nArea of Rectangle : %lf"
- "\nPerimeter of Rectangle : %lf"
- "\nArea of Circle : %lf"
- "\nCircumference of Circle : %lf",
- area_r, per, area_c, cir);
- return 0;
-}
-
-/* --- End of letusc/luc002.c --- */
-
-// File: letusc/luc003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc003.c
-
-/* Paper of size AO has dimensions 1189 mm x 841 mm.
-Each subsequent size A(n) is defined as A(n-1) cut in
-half, parallel to its shorter sides. Thus, paper of
-size A1 would have dimensions 841 mm x 594 mm. Write
-a program to calculate and print paper sizes A0,�
-A1,�A2,�...�A8. */
-/* Author - Amit Dutta, Date - 16th SEP, 2025 */
-/* Let Us C; Page - 19; Chap- 1; QNo.: F(c) */
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double s_long = 1189.0, s_short = 841.0, temp;
- int i;
- printf("A0 Dimension : %g mm x %g mm", floor(s_long), floor(s_short));
- for (i = 1; i <= 8; i++) {
- temp = s_long;
- s_long = s_short;
- s_short = temp / 2;
- printf("\nA%d Dimension : %g mm x %g mm", i, floor(s_long), floor(s_short));
- }
- return 0;
-}
-
-/* --- End of letusc/luc003.c --- */
-
-// File: letusc/luc004.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc004.c
-
-/* If a five digit number is input through the keyboard,
-write a program to calculate the sum of it's digit.
-(Hint : Use the modulus operator %) */
-/* Author - Amit Dutta, Date - 28th SEP, 2025 */
-/* Let Us C; Page - 37; Chap- 2; QNo.: G(a) */
-
-#include <stdio.h>
-int main()
-{
- int inp, result = 0, i, temp;
- printf("Enter a five digit number : ");
- scanf("%d", &inp);
- if (inp < 10000 || inp > 99999)
- {
- printf("\nPlease enter a valid five digit number.");
- return 1;
- }
- temp = inp;
- for (i = 1; i <= 5; i++)
- {
- result = result + (inp % 10);
- inp = inp / 10;
- }
- printf("\nSum of the digit '%d' is : %d", temp, result);
- return 0;
-}
-/* --- End of letusc/luc004.c --- */
-
-// File: letusc/luc005.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc005.c
-
-/* Write a program to recive Cartesian
-co-ordinates (x, y) of a point and convert
-them into Polar co-ordinates (r, phi)
- Hint : r = sqrt (x^2 + y^2) and phi = tan^-1 (y/x) */
-/* Author - Amit Dutta, Date - 28th SEP, 2025 */
-/* Let Us C; Page - 37; Chap- 2; QNo.: G(b) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double x, y, r, phi;
- printf("Enter the Cartesian Co-Ordinates in this format 'x, y' : ");
- scanf("%lf, %lf", &x, &y);
- r = sqrt(pow(x, 2) + pow(y, 2));
- phi = atan2(y, x);
- printf("\nPolar Co-Ordinates are : (%g, %g Rad)", r, phi);
- return 0;
-}
-/* --- End of letusc/luc005.c --- */
-
-// File: letusc/luc006.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc006.c
-
-/* Write a program to receive values of latitude (L1, L2) and longitude
-(G1, G2), in degrees, of two places on the earth and output the distance
-(D) between them in nautical miles. The formula for distance in nautical
-miles is :
- D = 3963 cos^-1(sin L1 sin L2 + cos L1 cos L2 * cos(G2 - G1))
-*/
-/* Author - Amit Dutta, Date - 29th SEP, 2025 */
-/* Let Us C, Chap - 2, Page - 37, Qn no.: G(c) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double l1, l2, g1, g2, d;
- printf("Enter the Latitude in 'L1, L2' format : ");
- scanf("%lf, %lf", &l1, &l2);
- printf("Enter the Longitude in 'G1, G2' format : ");
- scanf("%lf, %lf", &g1, &g2);
- // Converting degree to radian because function from math.h use radian not degree
- l1 = l1 * (M_PI / 180);
- l2 = l2 * (M_PI / 180);
- g1 = g1 * (M_PI / 180);
- g2 = g2 * (M_PI / 180);
- d = 3963 * acos(sin(l1) * sin(l2) + cos(l1) * cos(l2) * cos(g2 - g1));
- printf("Distance in nautical miles : %g", d);
- return 0;
-}
-/* --- End of letusc/luc006.c --- */
-
-// File: letusc/luc007.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc007.c
-
-/* Wind-chill factor is the felt air temperature on exposed skin due to wind.
-The wind-chill temperature is always lower than the air temperature, and is
-calculated as per the following formula.
- wcf = 35.74 + 0.6215t + (0.4275t - 35.75) * v^0.16
-Where t is temperature and v is wind velocity. Write a program to receive
-values of t and v and calcualate wind-chill factor (wcf). */
-/* Author - Amit Dutta, Date - 30th SEP, 2025 */
-/* Let Us C, Chap - 2, Page - 37, Qn No.: G(d) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double t, v, wcf;
- printf("Enter the temperature and velociy of the wind : ");
- scanf("%lf %lf", &t, &v);
- wcf = 35.74 + (0.6215 * t) + (((0.4275 * t) - 35.75) * pow(v, 0.16));
- printf("\nWind-chill factor (wcf) : %g", wcf);
- return 0;
-}
-/* --- End of letusc/luc007.c --- */
-
-// File: letusc/luc008.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc008.c
-
-/* If value of an angle is input through the keyboard,
-write a program to print all its trigonometric ratios. */
-/* Author - Amit Dutta, Date - 30th SEP, 2025 */
-/* Let Us C, Chap - 2, Page - 37, Qn No.: G(e) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double inp, rsin, rcos, rtan, rcosec, rsec, rcot;
- printf("Enter the Angle in degree : ");
- scanf("%lf", &inp);
- inp = inp * (M_PI / 180); //changing degree to radian
- rsin = sin(inp);
- rcos = cos(inp);
- rtan = tan(inp);
- rcosec = 1 / rsin;
- rsec = 1 / rcos;
- rcot = 1 / rtan;
- printf("\nTrigonometric ratios :-"
- "\nsin = %g "
- "\ncos = %g"
- "\ntan = %g"
- "\ncosec = %g"
- "\nsec = %g"
- "\ncot = %g",
- rsin, rcos, rtan, rcosec, rsec, rcot);
- return 0;
-}
-/* --- End of letusc/luc008.c --- */
-
-// File: letusc/luc009.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc009.c
-
-/* Two numbers are input through the keyboard into two locations
-C and D. Write a program to interchange the contents of C and D. */
-/* Author - Amit Dutta, Date - 30th SEP, 2025 */
-/* Let Us C, Chap - 2, Page - 37, Qn No.: G(d) */
-
-#include <stdio.h>
-int main()
-{
- double a, b;
- printf("Enter the two number A and B : ");
- scanf("%lf %lf", &a, &b);
- printf("\nBefore Interchange : ");
- printf("\nA = %g (Memory location = %p)", a, &a);
- printf("\nB = %g (Memory location = %p)", b, &b);
- a = a + b;
- b = a - b;
- a = a - b;
- printf("\nAfter Interchange :");
- printf("\nA = %g (Memory location = %p)", a, &a);
- printf("\nB = %g (Memory location = %p)", b, &b);
- return 0;
-}
-/* --- End of letusc/luc009.c --- */
-
-// File: letusc/luc010.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc010.c
-
-/* A five-digit number is entered through the keyboard. Write a program
-to obtain the reversed number and to etermine whether the original and reversed
-numbers are equal or not. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap - 3, Page - 53, Qn No.: f(a) */
-
-#include <stdio.h>
-int main()
-{
- int num, rev, temp, i;
- printf("Please enter the number : ");
- scanf("%d", &num);
- if (num < 10000 || num > 99999)
- {
- printf("\nPlease enter a five digit number.");
- return 1;
- }
- temp = num;
- for (i = 1; i <= 5; i++)
- {
- rev = (rev * 10) + num % 10;
- num = num / 10;
- }
- printf("\nReverse of the Input number : %d", rev);
- if (rev == temp)
- printf("\nOriginal and reversed numbers are equal.");
- else
- printf("\nOrigianl and reversed numbers are not equal.");
- return 0;
-}
-/* --- End of letusc/luc010.c --- */
-
-// File: letusc/luc011.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc011.c
-
-/* If ages of Ram, Shyam and Ajay are input through the keyboard,
-write a program to determine the youngest of the three. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(b) */
-
-#include <stdio.h>
-int main()
-{
- int ram, shyam, ajay;
- printf("Please enter the age of Ram, Shyam and Ajay : ");
- scanf("%d %d %d", &ram, ­am, &ajay);
- if (ram == shyam || ram == ajay || shyam == ajay)
- printf("\nThree must have different age.");
- if (ram < shyam && ram < ajay)
- printf("\nRam is the youngest. Age : %d", ram);
- if (shyam < ram && shyam < ajay)
- printf("\nShyam is the youngest. Age : %d", shyam);
- if (ajay < ram && ajay < shyam)
- printf("\nAjay is the youngest. Age : %d", ajay);
- return 0;
-}
-/* --- End of letusc/luc011.c --- */
-
-// File: letusc/luc012.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc012.c
-
-/* Write a program to check whether a triangle is valid or not,
-if three angles of the triangle are entered through the keyboard.
-A triangle is valid if the sum of all the three angles is equal to 180 degrees. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(c) */
-
-#include <stdio.h>
-int main()
-{
- double angle1, angle2, angle3, sum;
- printf("Enter the value of the three angle of the triangle : ");
- scanf("%lf %lf %lf", &angle1, &angle2, &angle3);
- sum = angle1 + angle2 + angle3;
- if (sum == 180.0)
- printf("\nThis Triangle is a valid one.");
- else
- printf("\nThis Triangle is not valid. Sum of the angles : %g", sum);
- return 0;
-}
-/* --- End of letusc/luc012.c --- */
-
-// File: letusc/luc013.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc013.c
-
-/* Write a program to find the absolute value
-of a number entered through the keyboard. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(d) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double num;
- printf("Enter the number : ");
- scanf("%lf", &num);
- num = abs(num);
- printf("\nAbsolute value of the input is : %g", num);
- return 0;
-}
-/* --- End of letusc/luc013.c --- */
-
-// File: letusc/luc014.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc014.c
-
-/* Given the length and breadth of a rectangle, write a program to find
-whether the area of the rectangle is greater than it's perimeter.
-For example, the area of the rectangle with length = 5 and breadth = 4
-is greater than its perimeter. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(e) */
-
-#include <stdio.h>
-int main()
-{
- double len, bre, area, peri;
- printf("Enter the length and breadth of the rectangle : ");
- scanf("%lf %lf", &len, &bre);
- area = len * bre;
- peri = 2 * (len + bre);
- if (area > peri)
- printf("\nThe area of the rectangle is greater than it's perimeter.");
- else if (area < peri)
- printf("\nThe area of the rectangle is lower than it's perimeter.");
- else
- printf("\nThe area of the rectangle is same as it's perimeter.");
- return 0;
-}
-/* --- End of letusc/luc014.c --- */
-
-// File: letusc/luc015.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc015.c
-
-/* Given three points (x1, y1), (x2, y2), and (x3, y3),
-write a program to check if the three poins fall on one straight line. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(f) */
-
-#include <stdio.h>
-#include <math.h>
-#define EPSILON 0.0001
-// Define a small tolerance value (EPSILON) for safe floating-point comparison
-// This is critical because of minor rounding errors in computer arithmetic.
-int main()
-{
- double x1, x2, x3, y1, y2, y3, area;
- printf("Enter the point A(x1, y1) : ");
- scanf("%lf %lf", &x1, &y1);
- printf("Enter the point B(x2, y2) : ");
- scanf("%lf %lf", &x2, &y2);
- printf("Enter the point C(x3, y3) : ");
- scanf("%lf %lf", &x3, &y3);
- area = 0.5 * ((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2)));
- if (fabs(area) < EPSILON) // abs() for integer, fabs() for float, double
- printf("\nA(%g, %g), B(%g, %g) and C(%g, %g) points fall on one straight line.", x1, y1, x2, y2, x3, y3);
- else
- printf("\nA(%g, %g), B(%g, %g) and C(%g, %g) points doesn't fall on one straight line.", x1, y1, x2, y2, x3, y3);
- return 0;
-}
-/* --- End of letusc/luc015.c --- */
-
-// File: letusc/luc016.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc016.c
-
-/* Given the coordiantes (x, y) of center of a circle and its radius,
-write a program that will determine whether a point lies inside the circle,
-on the circle or outside the circle. (Hint : Use sqrt() and pow() functions.) */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(g) */
-
-#include <stdio.h>
-#include <math.h>
-// Define a small tolerance value (EPSILON) for reliable floating-point comparison
-#define EPSILON 0.0001
-
-int main()
-{
- double h, k;
- double R;
- double x, y;
- double distance_sq;
- printf("Enter the center coordinates (h, k) : ");
- scanf("%lf %lf", &h, &k);
- printf("Enter the radius (R) : ");
- scanf("%lf", &R);
- printf("Enter the point P coordinates (x, y) : ");
- scanf("%lf %lf", &x, &y);
- distance_sq = pow(x - h, 2) + pow(y - k, 2);
- double radius_sq = R * R;
- // Case 1: On the circle (D^2 = R^2) - Use EPSILON for safety!
- if (fabs(distance_sq - radius_sq) < EPSILON)
- {
- printf("The point P(%g, %g) lies ON THE CIRCLE.\n", x, y);
- }
- // Case 2: Inside the circle (D^2 < R^2)
- else if (distance_sq < radius_sq)
- {
- printf("The point P(%g, %g) lies INSIDE THE CIRCLE.\n", x, y);
- }
- // Case 3: Outside the circle (D^2 > R^2)
- else
- {
- printf("The point P(%g, %g) lies OUTSIDE THE CIRCLE.\n", x, y);
- }
- return 0;
-}
-/* --- End of letusc/luc016.c --- */
-
-// File: letusc/luc017.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc017.c
-
-/* Given a point (x, y), write a program to find out if it lies on X-axis, Y-axis or origin. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(h) */
-
-#include <stdio.h>
-#include <math.h>
-#define EPSILON 0.00001
-
-int main()
-{
- double x, y;
- printf("Enter the point P(x, y) : ");
- scanf("%lf %lf", &x, &y);
- if (fabs(x) < EPSILON && fabs(y) < EPSILON)
- printf("\nPoint P(%g, %g) lies on the origin.", x, y);
- else if (fabs(x) < EPSILON)
- printf("\nPoint P(%g, %g) lies on the Y-Axis.", x, y);
- else if (fabs(y) < EPSILON)
- printf("\nPoint P(%G, %g) lies on the X-Axis.", x, y);
- else
- printf("\nThe point P(%g, %g) lies in a QUADRANT (not on an axis or the origin).", x, y);
- return 0;
-}
-/* --- End of letusc/luc017.c --- */
-
-// File: letusc/luc018.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc018.c
-
-/* According to Gregorian calender, it was Monday on the date 01/01/01.
-if any year is input through the keyboard write a program to find out
-what is the day on 1st January of this year. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(i) */
-
-#include <stdio.h>
-
-int is_leap(int year) {
- if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
- return 1;
- }
- return 0;
-}
-
-int main() {
- long long year; // long long for year input if years far in the future/past are tested
- int i;
- long long total_days = 0;
- int day_index;
-
- // Day names array for output
- const char *day_names[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
-
- printf("Enter the year (e.g., 2025): ");
- if (scanf("%lld", &year) != 1 || year < 1) {
- printf("Invalid year input. Please enter a positive integer year (>= 1).\n");
- return 1;
- }
- int years_passed = year - 1;
- long long leap_years = years_passed / 4 - years_passed / 100 + years_passed / 400;
- total_days = years_passed * 365 + leap_years;
- day_index = (total_days + 1) % 7;
- printf("\nOn January 1st, %lld, the day was: %s.\n", year, day_names[day_index]);
- return 0;
-}
-/* --- End of letusc/luc018.c --- */
-
-// File: letusc/luc018-logic.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc018-logic.c
-
-/* According to Gregorian calender, it was Monday on the date 01/01/01.
-Write a program to find out what is the day on 1st January of any input year. */
-/* Author - Amit Dutta, Date - 1st OCT, 2025 */
-/* Let Us C, Chap- 3, Page - 53, Qn No.: f(i) */
-
-#include <stdio.h>
-
-/**
- * @brief Determines if a given year is a leap year.
- * * The rule: A year is a leap year if it is divisible by 4, UNLESS it is
- * divisible by 100 but NOT by 400.
- * * @param year The year to check.
- * @return 1 if it is a leap year, 0 otherwise.
- */
-int is_leap(int year) {
- // Check if divisible by 400 OR (divisible by 4 AND not divisible by 100)
- if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
- return 1;
- }
- return 0;
-}
-
-/**
- * @brief Calculates the day of the week for January 1st of the given year.
- * * The base date is 01/01/01, which was a Monday (index 1).
- * * Day Mapping: 0:Sunday, 1:Monday, 2:Tuesday, 3:Wednesday, 4:Thursday, 5:Friday, 6:Saturday
- */
-int main() {
- long long year; // Use long long for year input if years far in the future/past are tested
- int i;
- long long total_days = 0;
- int day_index;
-
- // Day names array for output
- const char *day_names[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
-
- printf("Enter the year (e.g., 2025): ");
- if (scanf("%lld", &year) != 1 || year < 1) {
- printf("Invalid year input. Please enter a positive integer year (>= 1).\n");
- return 1;
- }
-
- // --- Core Logic: Calculate Total Days ---
-
- // We only need to consider the years that have *passed* before the target year.
- // So, we count days from the end of year 0 up to the end of year (year - 1).
- int years_passed = year - 1;
-
- // 1. Calculate the number of leap days up to the end of year (year - 1)
- // Formula based on Gregorian calendar rules for years Y-1:
- // (Y-1)/4 - (Y-1)/100 + (Y-1)/400
- long long leap_years = years_passed / 4 - years_passed / 100 + years_passed / 400;
-
- // 2. Total days = (Number of years * 365) + (Number of leap years)
- // Note: The loop method (below) is more intuitive but the formula is faster.
- // We will use the direct formula for efficiency.
- total_days = years_passed * 365 + leap_years;
-
- // --- Alternate Loop Method (for conceptual simplicity) ---
- /*
- for (i = 1; i < year; i++) {
- total_days += 365;
- if (is_leap(i)) {
- total_days += 1; // Add 1 for the leap day
- }
- }
- */
-
- // --- Determine the Day of the Week ---
-
- // Since 01/01/01 was Monday (index 1), we use the following setup:
- // Index 1 corresponds to Monday.
- // The calculation gives the number of days *past* the Monday start (01/01/01).
- // The modulo operation gives the remainder (0-6).
-
- // 0 days elapsed (Year 1): total_days=0. (0 + 1) % 7 = 1 (Monday). Correct.
- // 365 days elapsed (Year 2): total_days=365. (365 + 1) % 7 = 2 (Tuesday). Correct. (365 mod 7 = 1, 1+1 = 2)
-
- day_index = (total_days + 1) % 7;
-
- // Correct the Day Index to match the array (0:Sun, 1:Mon, ..., 6:Sat)
- // The +1 adjusts for the Monday starting point (index 1).
-
- printf("\nOn January 1st, %lld, the day was: **%s**.\n", year, day_names[day_index]);
-
- return 0;
-}
-/* --- End of letusc/luc018-logic.c --- */
-
-// File: letusc/luc019.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc019.c
-
-/* If the length of three sides of a triangle are entered through the
-keyboard, write a program to check whether the triangle is an isosceles,
-an equilateral, a scalene or a right-angled triangle. */
-/* Author - Amit Dutta, Date - 3rd OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 71, Qn No.: D(a) */
-
-#include <stdio.h>
-#include <math.h>
-
-#define EPSILON 0.000001
-/* EPSILON is used to compare double values for approximate equality,
-mitigating floating-point precision errors. */
-
-int main()
-{
- double side1, side2, side3;
- printf("Please enter the length of three side of the triangle : ");
- scanf("%lf %lf %lf", &side1, &side2, &side3);
- if (side1 < 1 || side2 < 1 || side3 < 1)
- {
- printf("\nLength of a side of triangle should be a positive integer.");
- return 1;
- }
- if (side1 + side2 < side3 || side1 + side3 < side2 || side2 + side3 < side1)
- {
- printf("\nEntered triangle is not VALID.");
- return 1;
- }
- // isosceles check
- if (side1 == side2 || side2 == side3 || side3 == side1)
- printf("\nEntered triangle is a ISOSCELES triangle.");
- else
- printf("\nEntered triangle is NOT a ISOSCELES triangle.");
- // equilateral check
- if (side1 == side2 && side2 == side3)
- printf("\nEntered triangle is a EQUILATERAL triangle.");
- else
- printf("\nEntered triangle is NOT a EQUILATERAL triangle.");
- // scalene check
- if (side1 != side2 && side2 != side3)
- printf("\nEntered triangle is a SCALENE triangle.");
- else
- printf("\nEntered triangle is NOT a SCALENE triangle.");
- // right-angle check
- if (fabs(((side1 * side1) + (side2 * side2)) - (side3 * side3)) < EPSILON ||
- fabs(((side2 * side2) + (side3 * side3)) - (side1 * side1)) < EPSILON ||
- fabs(((side3 * side3) + (side1 * side1)) - (side2 * side2)) < EPSILON)
- printf("\nEntered triangle is a RIGHT-ANGLED triangle.");
- else
- printf("\nEntered triangle is NOT a RIGHT-ANGLED triangle.");
- return 0;
-}
-/* --- End of letusc/luc019.c --- */
-
-// File: letusc/luc020.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc020.c
-
-/* In digital world colors are specified in Red-Green-Blue (RGB) format,
-with values of R, G, B varying on an integer scale from 0 to 255. In print
-publishing the colors are mentioned in Cyan-Magenta-Yellow-Black (CMYK) format,
-with values of C, M, Y, and K varying on a real scale from 0.0 to 1.0.
-Write a program that converts RGB color to CMYK color as per the following formulae:
- White = Max(Red/255, Green/255, Blue/255)
- Cyan = (White-Red/255) / White
- Magenta = (White-Green/255) / White
- Yellow = (White-Blue/255) / White
- Black = 1 - White
-Note that if the RGB values are all 0, then the CMY values are all 0 and the K value is 1. */
-/* Author - Amit Dutta, Date - 4th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 71, Qn No.: D(b) */
-
-#include <stdio.h>
-
-// declaring function
-double get_white(double red, double green, double blue)
-{
- double max;
- max = red / 255;
- if (max < (green / 255))
- max = green / 255;
- if (max < (blue / 255))
- max = blue / 255;
- return max;
-}
-
-int main()
-{
- double r, g, b, w, c = 0, m = 0, y = 0, k = 0;
- printf("Enter the RGB color code in 'R G B' format : ");
- scanf("%lf %lf %lf", &r, &g, &b);
-
- // checking for invalid input (negetive input)
- if (r < 0 || g < 0 || b < 0)
- {
- printf("\nRGB color code can not be a negetive number.");
- return 1;
- }
-
- // checking for invalid input (out of range color code)
- if (r > 255 || g > 255 || b > 255)
- {
- printf("\nRGB color code can be maximum (255, 255, 255).");
- return 1;
- }
-
- // converting RGB color code to CMYK color code
- if (r == 0 && g == 0 && b == 0)
- k = 1;
- else
- {
- w = get_white(r, g, b);
- c = (w - (r / 255)) / w;
- m = (w - (g / 255)) / w;
- y = (w - (b / 255)) / w;
- k = 1 - w;
- }
-
- printf("\nRGB color (%g, %g, %g) equivalent to CMYK color (%g, %g, %g, %g).", r, g, b, c, m, y, k);
- return 0;
-}
-/* --- End of letusc/luc020.c --- */
-
-// File: letusc/luc021.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc021.c
-
-/* A certain grade of steel is graded according to the following conditions:
- (i) Hardness must be greater than 50
- (ii) Carbon content must be less than 0.7
- (iii) Tensile strength must be greater than 5600
-
-The grades are as follows:
- Grade is 10 if all three conditions are met
- Grade is 9 if conditions (i) and (ii) are met
- Grade is 8 if conditions (ii) and (iii) are met
- Grade is 7 if conditions (i) and (iii) are met
- Grade is 6 if only one condition is met
- Grade is 5 if none of the conditions are met
-
-Write a program, which will require the user to give values of hardness,
-carbon content and tensile strength of the steel under consideration and output
-the grade of the steel. */
-
-/* Author - Amit Dutta, Date - 4th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 71, Qn No.: D(c) */
-
-#include <stdio.h>
-int main()
-{
- double hardness, carbon_content, tensile_strength;
- printf("Enter the details of the steel below - \n");
- printf("1. Hardness : ");
- scanf("%lf", &hardness);
- printf("2. Carbon Content : ");
- scanf("%lf", &carbon_content);
- printf("3. Tensile Strength : ");
- scanf("%lf", &tensile_strength);
-
- // storing how many conditions are met as boolean result
- int condition_met, condition1, condition2, condition3;
- condition1 = hardness > 50;
- condition2 = carbon_content < 0.7;
- condition3 = tensile_strength > 5600;
- condition_met = condition1 + condition2 + condition3;
-
- // now grading according the result
- int grade;
- if (condition_met == 3)
- grade = 10;
- else if (condition_met == 2)
- {
- if (condition1 && condition2)
- grade = 9;
- else if (condition2 && condition3)
- grade = 8;
- else if (condition1 && condition3)
- grade = 7;
- }
- else if (condition_met == 1)
- grade = 6;
- else
- grade = 5;
-
- // printing the result
- printf("\n------------- Result -------------");
- printf("\n1. Hardness : Condition %s", condition1 ? "MET" : "DID NOT MET");
- printf("\n2. Carbon Content : Condition %s", condition2 ? "MET" : "DID NOT MET");
- printf("\n3. Tensile Strength : Condition %s", condition3 ? "MET" : "DID NOT MET");
- printf("\nTotal Condition Met : %d", condition_met);
- printf("\n\nGrade : %d\n\n", grade);
- return 0;
-}
-
-/* I did not used this long variable names. I used very short just the first letter of the word.
-After writting the whole program, I just renamed the valiables. This is possible in Visual Stdio Code. */
-/* --- End of letusc/luc021.c --- */
-
-// File: letusc/luc022.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc022.c
-
-/* The Body Mass Index (BMI) is defined as ratio of weight of the
-person (in Kilograms) to square of the height (in meters).
-Write a program that receives weight and height, calculate the BMI, and reports
-the BMI catagory as per the following table.
- BMI Catagory BMI
- Starvation < 15
- Anorexic 15.1 to 17.5
- Underweight 17.6 to 18.5
- Ideal 18.6 to 24.9
- Overweight 25 to 25.9
- Obese 30 to 39.9
- Morbidly Obese >= 40
-*/
-/* Author - Amit Dutta, Date - 4th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 72, Qn No.: D(d) */
-
-#include <stdio.h>
-
-int main()
-{
- double weight, height, bmi;
- printf("Enter your Weight (in Kilograms) and Height (in Meters) : ");
- scanf("%lf %lf", &weight, &height);
- bmi = weight / (height * height);
- printf("\nCalculated BMI : %g", bmi);
- if (bmi < 15)
- printf("\nBMI Catagory : Starvation");
- else if (bmi >= 15.1 && bmi <= 17.5)
- printf("\nBMI Catagory : Anorexic");
- else if (bmi >= 17.6 && bmi <= 18.5)
- printf("\nBMI Catagory : Underweight");
- else if (bmi >= 18.6 && bmi <= 24.9)
- printf("\nBMI Catagory : Ideal");
- else if (bmi >= 25 && bmi <= 25.9)
- printf("\nBMI Catagory : Overweight");
- else if (bmi >= 30 && bmi <= 39.9)
- printf("\nBMI Catagory : Obese");
- else if (bmi >= 40)
- printf("\nBMI Catagory : Morbidly Obese");
- else
- printf("\nBMI Catagory : Unclassified");
- return 0;
-}
-/* --- End of letusc/luc022.c --- */
-
-// File: letusc/luc023.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc023.c
-
-/* Using conditional operators determine :
- (1) Whether the character entered through the keyboard is a
- lower case alphabet or not.
- (2) Whether a character entered through the keyboard is a special
- symbol or not. */
-/* Author - Amit Dutta, Date - 5th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 72, Qn No.: E(a) */
-
-#include <stdio.h>
-int main()
-{
- char inp;
- printf("Enter the character : ");
- scanf("%c", &inp);
- printf("\nInput Character '%c' is %s a LOWER CASE ALPHABET.", inp,
- (inp >= 'a' && inp <= 'z') ? "" : "NOT");
- printf("\nInput Character '%c' is %s a SPECIAL SYMBOL.", inp,
- (inp >= 'a' && inp <= 'z' || inp >= 'A' && inp <= 'Z'
- || inp >= '0' && inp <= '9') ? "NOT" : "");
- return 0;
-}
-/* --- End of letusc/luc023.c --- */
-
-// File: letusc/luc024.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc024.c
-
-/* Write a program using conditional operators to determine whether
-a year entered through the keyboard is a leap year or not. */
-/* Author - Amit Dutta, Date - 5th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 72, Qn No.: E(b) */
-
-#include <stdio.h>
-int main()
-{
- int year;
- printf("Enter the year : ");
- scanf("%d", &year);
- printf("\nYear %d is %s a Leapyear.", year, (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) ? "" : "NOT");
- return 0;
-}
-/* --- End of letusc/luc024.c --- */
-
-// File: letusc/luc025.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc025.c
-
-/* Write a program to find the greates of the three numbers entered
-through the keyboard. Use conditional operators. */
-/* Author - Amit Dutta, Date - 6th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 72, Qn No.: E(c) */
-
-#include <stdio.h>
-int main()
-{
- double num1, num2, num3, max;
- printf("Enter three number : ");
- scanf("%lf %lf %lf", &num1, &num2, &num3);
- printf("\nGreatest of the three number '%g', '%g' and '%g' is : '%g'", num1, num2, num3,
- (num1 > num2 && num1 > num3) ? num1 : ((num2 > num1 && num2 > num3) ? num2 : num3));
- return 0;
-}
-/* --- End of letusc/luc025.c --- */
-
-// File: letusc/luc026.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc026.c
-
-/* Write a program to recieve value of an angle in degreesand check
-whether sum of squares of sine and cosine of this angle is equal to 1. */
-/* Author - Amit Dutta, Date - 6th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 73, Qn No.: E(d) */
-
-#include <stdio.h>
-#include <math.h>
-#define EPSILON 0.0000001
-
-int main()
-{
- double angle, result;
- printf("Enter the angle value in degree : ");
- // checking if the input is other than number.
- if(scanf("%lf", &angle) != 1) {
- printf("\nPlease enter a number.");
- return 1;
- }
- angle = angle * (M_PI / 180); // converting degree to radian
- result = pow(sin(angle), 2) + pow(cos(angle), 2);
- (fabs(result - 1.0) < EPSILON) ?
- printf("\nsum of squares of sine and cosine of this angle is equal to 1.") :
- printf("\nsum of squares of sine and cosine of this angle is NOT equal to 1.");
- return 0;
-}
-/* --- End of letusc/luc026.c --- */
-
-// File: letusc/luc027.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc027.c
-
-/* Rewrite the folowing program using conditional operations
- #include<stdio.h>
- int main()
- {
- float sal;
- printf("Enter the salary");
- scanf("%f", &sal);
- if(sal >= 25000 && sal <= 40000)
- printf("Manager\n");
- else
- if(sal >= 15000 && sal < 25000)
- printf("Accountant\n");
- else
- printf("Clerk\n");
- return 0;
- }
-*/
-/* Author - Amit Dutta, Date - 6th OCT, 2025 */
-/* Let Us C, Chap- 4, Page - 73, Qn No.: E(e) */
-
-#include <stdio.h>
-int main()
-{
- float sal;
- printf("Enter the salary");
- scanf("%f", &sal);
- (sal >= 25000 && sal <= 40000) ? printf("Manager\n") :
- ((sal >= 15000 && sal < 25000) ? printf("Accountant\n") : printf("Clerk\n"));
- return 0;
-}
-/* --- End of letusc/luc027.c --- */
-
-// File: letusc/luc028.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc028.c
-
-/* Write a program to print all the ASCII values and their equivalent
-characters using a while loop. The ASCII may vary from 0 to 255. */
-/* Author - Amit Dutta, Date - 7th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(a) */
-
-#include <stdio.h>
-int main()
-{
- int i = 0;
- printf("ASCII Value\tCharacter");
- printf("\n-----------\t---------\n");
- while (i <= 255)
- {
- printf("%d.\t%c\n\n", i, i);
- i++;
- }
- return 0;
-}
-/* --- End of letusc/luc028.c --- */
-
-// File: letusc/luc029.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc029.c
-
-/* Write a program to print out all Armstrong numbers between 100
-and 500. If sum of cubes of each digit of the number is equal to the
-number itself, then the number is called an Armstrong number. For
-example, 153 = (1 * 1 * 1) + (5 * 5 * 5) + (3 * 3 * 3) */
-/* Author - Amit Dutta, Date - 7th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(b) */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- int num = 100, temp1, temp2, res;
- printf("Armstrong numbers between 100 and 500 :");
- while (num <= 500)
- {
- temp1 = num;
- res = 0;
- while (temp1 != 0)
- {
- temp2 = temp1 % 10;
- res = res + pow(temp2, 3);
- temp1 = temp1 / 10;
- }
- if (num == res)
- printf(" %d", num);
- num++;
- }
- return 0;
-}
-/* --- End of letusc/luc029.c --- */
-
-// File: letusc/luc030.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc030.c
-
-/* Write a program for a matchstick game being played between the
-computer and a user. Your program should ensure that the computer
-always wins. Rules for the game are as follows :
- - There are 21 matchsticks.
- - The computer asks the player to pick 1, 2, 3, or 4 matchsticks.
- - After the person picks, the computer does its picking.
- - Whoever is forced to pick up the last matchstick loses the game.
-*/
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(c) */
-
-/* My Plan: The total number of matchsticks is 21. To guarantee a win,
-the computer ensures that after its turn, the number of remaining
-matchsticks is always a multiple of 5 plus 1 (i.e., 16, 11, 6, 1).
-This is achieved by making the sum of the player's pick and the
-computer's pick equal to 5 in each round. This forces the player
-to pick the final matchstick. */
-
-#include <stdio.h>
-int main()
-{
- int remaining_matchsticks = 21, player_pick, computer_pick;
- printf(" --- Matchstick Game ---\n");
- printf("Rules: There are 21 matchsticks. You can pick 1, 2, 3, or 4.\n");
- printf("Whoever is forced to pick the last matchstick loses the game.\n");
- while (remaining_matchsticks > 1)
- {
- // game start
- printf("\n--------------------------");
- printf("\nRemaining Matchsticks : %d", remaining_matchsticks);
-
- // player pick and checking input is valid or not
- printf("\nYour turn: Pick 1, 2, 3, or 4 matchsticks: ");
- if (scanf("%d", &player_pick) != 1)
- {
- printf("\n\tPlease enter a number.");
- while (getchar() != '\n')
- ;
- continue;
- }
-
- // checking player pick is valid or not
- if (player_pick < 1 || player_pick > 4)
- {
- printf("\n\tPlease enter a number among 1, 2, 3 and 4.");
- while (getchar() != '\n')
- ;
- continue;
- }
-
- if (player_pick > remaining_matchsticks)
- {
- printf("\nInvalid choice! There are not enough matchsticks left.");
- while (getchar() != '\n')
- ;
- continue;
- }
-
- // computer_picks
- computer_pick = 5 - player_pick;
- printf("\ncomputer_picks : %d", computer_pick);
-
- // remaining matchsticks
- remaining_matchsticks = remaining_matchsticks - (player_pick + computer_pick);
- }
-
- // game over
- printf("\n----------------------------------\n");
- printf("Only 1 matchstick is left.\n");
- printf("You are forced to pick the last matchstick. You lose!\n");
- printf("The computer wins.\n");
-
- return 0;
-}
-/* --- End of letusc/luc030.c --- */
-
-// File: letusc/luc031.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc031.c
-
-/* Write a program to enter numbers till the user wants. At the end it
-should display the count of positive, negative and zeros entered. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(d) */
-
-#include <stdio.h>
-int main()
-{
- int choice = 1, num, positive_count = 0, negative_count = 0, zero_count = 0;
- while (choice == 1)
- {
- printf("\nEnter the number (Type any character and press Enter to finish.) : ");
- choice = scanf("%d", &num); // Checking whether the user has input any characters
- if (choice == 1)
- {
- printf("Number recorded : %d", num);
- if (num < 0)
- negative_count++;
- else if (num > 0)
- positive_count++;
- else if (num == 0)
- zero_count++;
- }
- else
- {
- // If the user inputs any characters, then choice = 0, it means he doesn't want to give any more input;
- choice = 0;
- printf("\nCharacter received. Stopping input...\n");
- }
- }
- // Display the final results
- printf("\n====================================\n");
- printf(" Analysis Complete\n");
- printf("====================================\n");
- printf("Positive numbers entered: %d\n", positive_count);
- printf("Negative numbers entered: %d\n", negative_count);
- printf("Zeroes entered: %d\n", zero_count);
- printf("Total numbers recorded: %d\n", positive_count + negative_count + zero_count);
- printf("====================================\n");
-}
-/* --- End of letusc/luc031.c --- */
-
-// File: letusc/luc031-logic.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc031-logic.c
-
-/* Write a program to enter numbers till the user wants. At the end it
-should display the count of positive, negative and zeros entered. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(d) */
-
-/*
- * DETAILED PROGRAM PLAN:
- * 1. INITIALIZATION: Set three counters (positive_count, negative_count, zero_count) to zero.
- * 2. INPUT LOOP: Start an infinite loop to continuously request user input.
- * 3. READ INPUT: Use fgets() to read the user's input as a generic string (char array).
- * This allows the program to accept multi-digit numbers (e.g., "-500") or the command ('n').
- * 4. TERMINATION CHECK: Immediately check if the input string is exactly "n" using strcmp().
- * If true, the user wants to quit, so break the loop.
- * 5. VALIDATION & CONVERSION: If the input is not "n", use sscanf() to safely attempt to convert
- * the string into an integer.
- * 6. COUNTING LOGIC: If sscanf() successfully reads an integer (sscanf returns 1):
- * - If the number is > 0, increment positive_count.
- * - If the number is < 0, increment negative_count.
- * - If the number is == 0, increment zero_count.
- * 7. ERROR HANDLING: If the input is neither "n" nor a valid number (sscanf returns 0),
- * inform the user of invalid input and continue the loop.
- * 8. FINAL DISPLAY: After the loop terminates, print the final totals for positive, negative, and zero counts.
- */
-
-#include <stdio.h>
-#include <stdlib.h> // for strtol
-#include <string.h> // for strcmp
-
-// Maximum size of the input line
-#define MAX_INPUT_LEN 15
-
-int main() {
- // Initialize counters
- int positive_count = 0;
- int negative_count = 0;
- int zero_count = 0;
-
- // Buffer to store the user's input as a string (e.g., "123", "-50", or "n")
- char input_buffer[MAX_INPUT_LEN];
- int number;
-
- printf("--- Number Analyzer ---\n");
- printf("Enter numbers one by one. Type 'n' and press Enter to finish.\n\n");
-
- // Loop until the user enters 'n'
- while (1) {
- printf("Enter number or 'n': ");
-
- // Read the entire line of input into the buffer
- if (fgets(input_buffer, MAX_INPUT_LEN, stdin) == NULL) {
- // Handle EOF (end of file) or reading error
- break;
- }
-
- // Remove the trailing newline character from the input_buffer
- // The last character will be '\n' if the input was shorter than MAX_INPUT_LEN
- size_t len = strlen(input_buffer);
- if (len > 0 && input_buffer[len - 1] == '\n') {
- input_buffer[len - 1] = '\0';
- }
-
- // 1. Check for the termination condition
- if (strcmp(input_buffer, "n") == 0) {
- printf("\n'n' received. Stopping input...\n");
- break; // Exit the while loop
- }
-
- // 2. Attempt to convert the input string to an integer
- // sscanf attempts to read the string according to the format "%d" (decimal integer)
- // It returns 1 if a number was successfully read.
- int conversions = sscanf(input_buffer, "%d", &number);
-
- if (conversions == 1) {
- // Conversion was successful, now check the number's sign
- if (number > 0) {
- positive_count++;
- } else if (number < 0) {
- negative_count++;
- } else {
- zero_count++;
- }
- printf(" -> Number recorded: %d\n", number);
- } else {
- // Conversion failed. The input was neither 'n' nor a valid integer.
- printf(" -> Invalid input. Please enter a valid number or 'n'.\n");
- }
- }
-
- // Display the final results
- printf("\n====================================\n");
- printf(" Analysis Complete\n");
- printf("====================================\n");
- printf("Positive numbers entered: %d\n", positive_count);
- printf("Negative numbers entered: %d\n", negative_count);
- printf("Zeroes entered: %d\n", zero_count);
- printf("Total numbers recorded: %d\n", positive_count + negative_count + zero_count);
- printf("====================================\n");
-
- return 0;
-}
-/* --- End of letusc/luc031-logic.c --- */
-
-// File: letusc/luc032.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc032.c
-
-/* Write a program to recieve an integer and find its octal equivalent.
-(Hint : To obtain octal equivalent of an integer, Divide it continuously
-by 8 till dividend does not become zero, then write the remainders
-obtained in reverse derection.) */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(e) */
-
-// using array
-
-#include <stdio.h>
-int main()
-{
- int octal[20], decimal, index = 0, temp, rem;
- printf("Enter the decimal number : ");
- scanf("%d", &decimal);
- temp = decimal;
- while (temp != 0)
- {
- rem = temp % 8;
- temp = temp / 8;
- octal[index] = rem;
- index++;
- }
- printf("\nDeciaml %d to octal : ", decimal);
- while ((index - 1) >= 0)
- {
- printf("%d", octal[index - 1]);
- index--;
- }
- return 0;
-}
-/* --- End of letusc/luc032.c --- */
-
-// File: letusc/luc033.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/luc033.c
-
-/* Write a program to find the range of a set of numbers entered
-through the keyboard. Range is the difference between the smallest
-and biggest number in the list. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-/* Let Us C, Chap- 5, Page - 87, Qn No.: B(f) */
-
-#include <stdio.h>
-int main()
-{
- int choice = 1, set_of_numbers[30], num, index = -1;
- while (choice == 1)
- {
- printf("\nEnter the number (Type any character and press Enter to finish.) : ");
- choice = scanf("%d", &num); // Checking whether the user has input any characters
- if (choice != 1)
- {
- // If the user inputs any characters, then choice = 0, it means he doesn't want to give any more input;
- choice = 0;
- printf("\nCharacter received. Stopping input...\n");
- break;
- }
- index++;
- set_of_numbers[index] = num;
- }
- int max = set_of_numbers[0], min = set_of_numbers[0];
- while (index >= 0)
- {
- if (max < set_of_numbers[index])
- max = set_of_numbers[index];
- if (min > set_of_numbers[index])
- min = set_of_numbers[index];
- index--;
- }
- int range = max - min;
- printf("\nBiggest number in the set : %d", max);
- printf("\nSmallest number in the set : %d", min);
- printf("\nRange : %d", range);
- return 0;
-}
-/* --- End of letusc/luc033.c --- */-
\ No newline at end of file
diff --git a/print/print-lucp.pdf b/print/print-lucp.pdf
Binary files differ.
diff --git a/print/print-lucp.txt b/print/print-lucp.txt
@@ -1,253 +0,0 @@
-// File: letusc/lucproblem001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem001.c
-
-/* Consider a currency system in which there are notes of six denominations,
-namely, Rs. 1, Rs. 2, rs. 5, Rs. 10, Rs. 50, Rs. 100. If a sum
-of Rs. N is entered through the keyboard, Write a program to compute
-the smallest number of notes that will combine to give Rs. N. */
-/* Author - Amit Dutta, Date - 29th SEP, 2025 */
-/* Let Us C, Chap - 2, Page - 22, Problem 2.3 */
-
-#include <stdio.h>
-int main()
-{
- int n, nonotes, temp;
- printf("Enter the amount : ");
- scanf("%d", &n);
- if (n < 1)
- {
- printf("\nAmount should be a positive integer.");
- return 1;
- }
- temp = n;
- nonotes = n / 100;
- n = n % 100;
- nonotes = nonotes + (n / 50);
- n = n % 50;
- nonotes = nonotes + (n / 10);
- n = n % 10;
- nonotes = nonotes + (n / 5);
- n = n % 5;
- nonotes = nonotes + (n / 2);
- n = n % 2;
- nonotes = nonotes + n;
- printf("\nthe smallest number of notes that will combine to give Rs. %d : %d", temp, nonotes);
- return 0;
-}
-/* --- End of letusc/lucproblem001.c --- */
-
-// File: letusc/lucproblem002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem002.c
-
-/* A year is entered through the keyboard, write a program to
-determine whether the year is leap or not. Use the logical operators
-&& and || . */
-/* Author - Amit Dutta, Date - 02th OCT, 2025 */
-/* Let Us C, Chap - 4, Page - 64, Problem 4.1 */
-
-#include <stdio.h>
-int main()
-{
- int year;
- printf("Enter year : ");
- scanf("%d", &year);
- if (year % 4 == 0 && year & 100 != 0 || year % 400 == 0)
- printf("\nYear %d is a leapyear.", year);
- else
- printf("\nYear %d is not a leapyear.", year);
- return 0;
-}
-/* --- End of letusc/lucproblem002.c --- */
-
-// File: letusc/lucproblem003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem003.c
-
-/* If a character is entered through the keyboard, Write a program
-to determine whether the character is a capital letter, a small case letter,
-a digit or a speacial symbol.
-The following table shows the range of ASCII values for various characters :
- Characters ASCII Values
- A - Z 65 - 90
- a - z 97 - 122
- 0 - 9 48 - 57
- special symbols 0 - 47, 58 - 64, 91 - 96, 123 - 127
-*/
-/* Author - Amit Dutta, Date - 02th OCT, 2025 */
-/* Let Us C, Chap - 4, Page - 65, Problem 4.2 */
-
-#include <stdio.h>
-int main()
-{
- char inp;
- printf("Enter one character : ");
- scanf(" %c", &inp);
- if (inp >= 64 && inp <= 90)
- printf("\nInput '%c' is a CAPITAL LETTER.", inp);
- if (inp >= 97 && inp <= 122)
- printf("\nInput '%c' is a SMALL CASE LETTER.", inp);
- if (inp >= 48 && inp <= 57)
- printf("\nInput '%c' is a DIGIT.", inp);
- if (inp >= 0 && inp <= 47 || inp >= 58 && inp <= 64
- || inp >= 91 && inp <= 96 || inp >= 123 && inp <= 127)
- printf("\nInput '%c' is a SPECIAL SYMBOL.", inp);
- return 0;
-}
-/* --- End of letusc/lucproblem003.c --- */
-
-// File: letusc/lucproblem004.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem004.c
-
-/* If the lengths of three sides of a triangle are entered through the
-keyboard, write a program to check whether the triangle is valid or not.
-The triangle is valid if the sum of two sides is greater that the largest
-of the three sides. */
-/* Author - Amit Dutta, Date - 02th OCT, 2025 */
-/* Let Us C, Chap - 4, Page - 66, Problem 4.3 */
-
-#include <stdio.h>
-int main()
-{
- double side1, side2, side3;
- printf("Enter the length of side1, side2 and side3 of the triangle : ");
- scanf("%lf %lf %lf", &side1, &side2, &side3);
- if (side1 <= 0 || side2 <= 0 || side3 <= 0)
- {
- printf("\nTriangle sides must be positive.\n");
- return 1;
- }
- if ((side1 + side2 > side3) && (side1 + side3 > side2) && (side2 + side3 > side1))
- // Triangle Inequality Theorem
- printf("\nThis triangle is valid.");
- else
- printf("\nThis triangle is not valid.");
- return 0;
-}
-/* --- End of letusc/lucproblem004.c --- */
-
-// File: letusc/lucproblem005.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem005.c
-
-/* Write a program to calculate overtime pay of 10 employees. Overtime is
-paid at the rate of Rs. 120.00 per hour for every hour worked above 40
-hours. Assume that employees do not work for fractional part of an hour. */
-/* ONLY WHILE LOOP ALLOWED */
-/* Author - Amit Dutta, Date - 07th OCT, 2025 */
-/* Let Us C, Chap - 5, Page - 83, Problem 5.1 */
-
-#include <stdio.h>
-#include <conio.h>
-int main()
-{
- int working_hour, i = 1;
- double pay;
- while (i <= 10)
- {
- printf("Enter the working hour for the employee no. %d : ", i);
- if (scanf("%d", &working_hour) != 1)
- {
- printf("\n\tPlease enter a number as woking hour.\n\n");
- while (getchar() != '\n')
- ;
- // above line discard the input characters untill getchar() reaches the new line character.
- /* if I do not discard the input, after 'continue;' statement that input will be again taken
- by scanf (In the line 17). It will be a infinite loop of error. */
- continue;
- }
- // checking overtime
- if (working_hour > 40)
- {
- pay = (working_hour - 40) * 120.00;
- printf("\n\tOvertime working hours of Employee %d : %d", i, (working_hour - 40));
- printf("\n\tPay of the overtime for Employee %d : Rs. %.2f\n\n", i, pay);
- }
- else
- printf("\n\tEmployee %d did not work any overtime.\n\n", i);
- i++; // changing to next employee
- }
-}
-/* --- End of letusc/lucproblem005.c --- */
-
-// File: letusc/lucproblem006.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem006.c
-
-/* Write a program to find the factorial value of any number entered
-through the keyboard. */
-/* Author - Amit Dutta, Date - 07th OCT, 2025 */
-/* Let Us C, Chap - 5, Page - 84, Problem 5.2 */
-
-#include <stdio.h>
-int main()
-{
- int num, i = 1;
- long long fact = 1;
- printf("Enter the number : ");
- // checking if the input is valid or not
- if (scanf("%d", &num) != 1)
- {
- printf("\nPlease enter a number.");
- return 1;
- }
- // result for the negetive input
- if (num < 0)
- {
- printf("\nFactorial of %d : Undefined", num);
- return 1;
- }
- // Hard codded result for input '0' (zero)
- if (num == 0)
- {
- printf("\nFactorial of 0 : 1");
- return 0;
- }
- // calculating result
- while (i <= num) {
- fact = fact * i;
- i++;
- }
- printf("\nFactorial of %d : %d", num, fact);
- return 0;
-}
-/* --- End of letusc/lucproblem006.c --- */
-
-// File: letusc/lucproblem007.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/letusc/lucproblem007.c
-
-/* Two numbers are entered through the keyboard. Write a program to
-find the value of one number raised to the power of another */
-/* Author - Amit Dutta, Date - 07th OCT, 2025 */
-/* Let Us C, Chap - 5, Page - 84, Problem 5.3 */
-
-#include <stdio.h>
-int main()
-{
- double num, result;
- int power, i = 1;
- printf("Enter the numbers in 'num^power' format : ");
- // checking if the input is valid or not
- if (scanf("%lf^%d", &num, &power) != 2)
- {
- printf("\nPlease enter numbers.");
- return 1;
- }
- // result for the negetive input
- if (power < 0)
- {
- printf("\nPlease use a positive number as power.");
- return 1;
- }
- // Hard codded result for input '0' (zero)
- if (power == 0)
- {
- printf("\n%g to the power of %d is : 1", num, power);
- return 0;
- }
- result = num;
- while (i <= power - 1)
- {
- result = result * num;
- i++;
- }
- printf("\n%g to the power of %d is : %g", num, power, result);
- return 0;
-}
-/* --- End of letusc/lucproblem007.c --- */-
\ No newline at end of file
diff --git a/print/print-prac.pdf b/print/print-prac.pdf
Binary files differ.
diff --git a/print/print-prac.txt b/print/print-prac.txt
@@ -1,223 +0,0 @@
-// File: tuition-c/APC-PRAC-001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-001.c
-
-/* WAP to calculate area and perimeter of a rectangle
-by accepting length and breadth as input. */
-// Author - Amit Dutta, Date - 18th SEP, 2025
-
-#include<stdio.h>
-int main() {
- double length, breadth, area, perimeter;
- printf("Enter the length and breadth of the Rectangle : ");
- scanf("%lf %lf", &length, &breadth);
- area = length * breadth;
- perimeter = 2 * (length + breadth);
- printf("\nArea of the Rectangle : %g"
- "\nPerimeter of the Rectangle : %g", area, perimeter);
- return 0;
-
-}
-
-
-/* --- End of tuition-c/APC-PRAC-001.c --- */
-
-// File: tuition-c/APC-PRAC-002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-002.c
-
-/* WAP to calculate area of a circle using math library
-method. Take radius of the circle as input. */
-/* Author - Amit Dutta, Date - 18th SEP, 2025 */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double r, area;
- printf("Enter the radius of the circle : ");
- scanf("%lf", &r);
- area = M_PI * pow(r, 2);
- printf("\nArea of the circle : %g", area);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-002.c --- */
-
-// File: tuition-c/APC-PRAC-003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-003.c
-
-/* WAP to accept diagonal of a square and calculate area, parimeter */
-/* Author - Amit Dutta, Date - 18th SEP, 2025 */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double dia, side, area, peri;
- printf("Enter the diagonal of the square : ");
- scanf("%lf", &dia);
- side = dia / sqrt(2);
- area = pow(side, 2);
- peri = 4 * side;
- printf("\nArea of the square : %g"
- "\nPerimeter of the square : %g",
- area, peri);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-003.c --- */
-
-// File: tuition-c/APC-PRAC-004.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-004.c
-
-/* WAP to calculate and display radius of a circle by taking the area as input. */
-/* Author - Amit Dutta, Date - 18th SEP, 2025 */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double r, area;
- printf("Enter the area of the circle : ");
- scanf("%lf", &area);
- r = sqrt(area / M_PI);
- printf("\nRadius of the circle : %g", r);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-004.c --- */
-
-// File: tuition-c/APC-PRAC-005.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-005.c
-
-/* WAP a program that accept number of days
-as input and represent it as years, months and days. */
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-int main()
-{
- int days, months, years, temp;
- printf("Enter the No. of days : ");
- scanf("%d", &days);
- temp = days;
- years = days / 365;
- days = days % 365;
- months = days / 30;
- days = days % 30;
- printf("%d Days = %d Years, %d Months, %d Days", temp, years, months, days);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-005.c --- */
-
-// File: tuition-c/APC-PRAC-006.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-006.c
-
-/* WAP that accept seconds as input and represent it an hours, minutes and seconds. */
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-int main()
-{
- int sec, hours, minutes, temp;
- printf("Enter the no of seconds : ");
- scanf("%d", &sec);
- temp = sec;
- hours = sec / 3600;
- sec = sec % 3600;
- minutes = sec / 60;
- sec = sec % 60;
- printf("\n%d Seconds = %d Hours, %d Minutes, %d Seconds.", temp, hours, minutes, sec);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-006.c --- */
-
-// File: tuition-c/APC-PRAC-007.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-007.c
-
-/* WAP that accept basic salary of an employee and display gross salary,
-net salary generated by below formula.
- DA = 25% of the basic salary.
- HRA = 12.5% of the basic salary.
- PF = 10% of the basic salary.
- gross salary = basic salary + da + hra
- net salary = gross salary - pf
-*/
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-int main()
-{
- double bs, gs, ns, da, hra, pf;
- printf("Enter the basic salary of the employee : ");
- scanf("%lf", &bs);
- da = bs * 0.25;
- hra = bs * 0.125;
- pf = bs * 0.10;
- gs = bs + da + hra;
- ns = gs - pf;
- printf("\nGross Salary : %g"
- "\nNet Salary : %g",
- gs, ns);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-007.c --- */
-
-// File: tuition-c/APC-PRAC-008.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-008.c
-
-/* WAP to multiply and divide a number by 4 without
-using multiplication and division operator. */
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-int main()
-{
- int num, multi, div;
- printf("Enter the number : ");
- scanf("%d", &num);
- multi = num << 2;
- div = num >> 2;
- printf("Multiplication : %d"
- "\nDivision : %d",
- multi, div);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-008.c --- */
-
-// File: tuition-c/APC-PRAC-009.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-009.c
-
-/* WAP to swap two integer variable without using Third variable. */
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-int main()
-{
- int a = 4, b = 6;
- printf("Before swap : A = %d and B = %d", a, b);
- a = a ^ b;
- b = a ^ b;
- a = a ^ b;
- printf("\nAfter swap : A = %d and B = %d", a, b);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-009.c --- */
-
-// File: tuition-c/APC-PRAC-010.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/APC-PRAC-010.c
-
-/* WAP to calculate and display the valve of the given expression :
- (1/a^3) + (1/(b+2)^3) + (1/(c^4 + root(2)))
- take a, b, c as input.
-*/
-/* Author - Amit Dutta, Date - 19th SEP, 2025 */
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- double a, b, c, result;
- printf("Enter the value for a, b and c : ");
- scanf("%lf %lf %lf", &a, &b, &c);
- result = (1 / pow(a, 3)) + (1 / pow((b + 2), 3)) + (1 / (pow(c, 4) + sqrt(2)));
- printf("\nResult = %g", result);
- return 0;
-}
-/* --- End of tuition-c/APC-PRAC-010.c --- */-
\ No newline at end of file
diff --git a/print/print-tuition.pdf b/print/print-tuition.pdf
Binary files differ.
diff --git a/print/print-tuition.txt b/print/print-tuition.txt
@@ -1,716 +0,0 @@
-// File: tuition-c/P001.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P001.c
-
-//sample code
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- printf("Hello world");
- return 0;
-}
-
-/* --- End of tuition-c/P001.c --- */
-
-// File: tuition-c/P002.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P002.c
-
-//sample code with a new line charecter
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- printf("Hello\nworld");
- return 0;
-}
-
-/* --- End of tuition-c/P002.c --- */
-
-// File: tuition-c/P003.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P003.c
-
-//WAP to perform addtion and multiplication of two integer numbers
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- int a, b, sum, multi;
- printf("Enter the 1st number : ");
- scanf("%d",&a);
- printf("Enter the 2nd number : ");
- scanf("%d",&b);
- sum = a + b;
- multi = a * b;
- printf("\nSum = %d"
- "\nMultiplication = %d",sum,multi);
- return 0;
-}
-
-/* --- End of tuition-c/P003.c --- */
-
-// File: tuition-c/P004.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P004.c
-
-/* WAP to find and display the value of given expression :
-((x+3)/4) - ((2x+4)/3) taking the value of x = 5 */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- double x =5, result;
- result = ((x + 3) / 4) - ((2 * x + 4) / 3);
- printf("Result = %lf",result);
- return 0;
-}
-
-/* --- End of tuition-c/P004.c --- */
-
-// File: tuition-c/P005.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P005.c
-
-/* A person is paid Rs. 455 for each day he works and fined
-Rs. 150 for each day he remains absent. WAP to calculate his
-monthly income taking the number of days present as input. */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- int daily_wage = 455, fine = 150, present, absent, income;
- printf("No of days present : ");
- scanf("%d", &present);
- absent = 30 - present;
- income = (present * 455) - (absent * 150);
- printf("\nIncome : %d",income);
- return 0;
-}
-
-/* --- End of tuition-c/P005.c --- */
-
-// File: tuition-c/P006.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P006.c
-
-/* The normal temperature of human body
-is 98.6 Degree Fahrenheit. WAP to convert the temperature
-to Degree Celcius and display the output. */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- double f = 98.6, c;
- c = ((f - 32) * 5) / 9;
- printf("Temperature in Celcius is : %lf",c);
- return 0;
-}
-
-/* --- End of tuition-c/P006.c --- */
-
-// File: tuition-c/P007.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P007.c
-
-/* A shopkeeper offers 10% discount on printed
-price of a digital camera. However a customer has
-to pay 6% GST on the remaining amount. WAP to
-calculate and display the amount to paid by the
-customer, taking the printed price as input. */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- double mrp, final_price, temp;
- printf("Enter the printed price : ");
- scanf("%lf", &mrp);
- temp = mrp * 0.90;
- final_price = temp * 1.06;
- printf("\nCustomer have to pay : %lf", final_price);
- return 0;
-}
-
-/* --- End of tuition-c/P007.c --- */
-
-// File: tuition-c/P008.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P008.c
-
-/* A shopkeeper offers 30% discount on purchasing an
-item whereas the other shopkeeper offers 2 successive
-discount of 20% and 10% for purchasing the same item.
-WAP to caompute and display the discounted price of the
-item by taking the price as input. */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- double mrp, shop1, shop2, temp;
- printf("Enter the price : ");
- scanf("%lf", &mrp);
- shop1 = mrp * 0.70;
- temp = mrp * 0.80;
- shop2 = temp * 0.90;
- printf("\nShopkeeper 1 price : %lf"
- "\nShopkeeper 2 price : %lf",shop1,shop2);
- return 0;
-}
-
-/* --- End of tuition-c/P008.c --- */
-
-// File: tuition-c/P009.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P009.c
-
-/* WAP to calculate gross and net salary
-by accepting basic salary as input.
-IMP : DA = 30% of Basic Pay
- HRA = 20% of Basic Pay
- PF = 12.5% of Basic Pay
- Gross Salary = Basic Pay + DA + HRA
- Net Salary = Gross Salary - PF
-*/
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- double bs, da, hra, pf, gs, ns;
- printf("Enter the Basic Salary : ");
- scanf("%lf", &bs);
- da = bs * 0.3;
- hra = bs * 0.2;
- pf = bs * 0.125;
- gs = bs + da + hra;
- ns = gs - pf;
- printf("\nGross Salary : %lf"
- "\nNet Salary : %lf", gs, ns);
- return 0;
-}
-
-/* --- End of tuition-c/P009.c --- */
-
-// File: tuition-c/P010.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P010.c
-
-/* WAP to find and display the difference
-between compound Interest and Simple Interest.
-Take principle amount as input.
-Hint : si = (p * r * t) / 100
- a = p * ((1 + (r / 100)) ^ t)
- ci = a - p
-*/
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double p, r, t, si, a, ci, dif;
- printf("Enter the principle amount, rate of interest, time in year : ");
- scanf("%lf %lf %lf", &p, &r, &t);
- si = (p * r * t) / 100;
- a = p * pow((1 + (r / 100)), t);
- ci = a - p;
- dif = ci - si;
- printf("\nSimple Interest : %lf"
- "\nCompound Interest : %lf"
- "\nInterest Difference : %lf", si, ci, dif);
- return 0;
-}
-
-/* --- End of tuition-c/P010.c --- */
-
-// File: tuition-c/P011.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P011.c
-
-/* The time period of a simple pendulam is
-given by the formula :
- t = 2 * pi * square_root(l / g)
-WAP to calculate T take length(L) and gravity
-as input
-*/
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double l, g, t;
- printf("Enter the Length and Gravity measures : ");
- scanf("%lf %lf", &l, &g);
- t = 2 * M_PI * sqrt(l / g);
- // using M_PI variable for PI value from math.h header file
- printf("\nTime Period : %lf", t);
- return 0;
-}
-
-/* --- End of tuition-c/P011.c --- */
-
-// File: tuition-c/P012.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P012.c
-
-/* WAP to swap two integer variable without
-using third variable */
-// using Approch Mode : simple, slow, time consuming
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- int a = 4, b = 6;
- printf("Before Swap : A = %d, B = %d", a, b);
- a = a + b;
- b = a - b;
- a = a - b;
- printf("\nAfter Swap : A = %d, B = %d", a, b);
- return 0;
-}
-
-/* --- End of tuition-c/P012.c --- */
-
-// File: tuition-c/P013.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P013.c
-
-/* WAP to swap two integer variable without
-using third variable */
-// using Approch Mode : complex, fast, less time consumimg
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- int a = 4, b = 6;
- printf("Before Swap : A = %d, B = %d", a, b);
- a = a ^ b;
- b = a ^ b;
- a = a ^ b;
- printf("\nAfter Swap : A = %d, B = %d", a, b);
- return 0;
-}
-
-/* --- End of tuition-c/P013.c --- */
-
-// File: tuition-c/P014.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P014.c
-
-/* WAP to accept the diagonal of
-square. Find and display the area and
-perimeter of the square. */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double d, side, area, per;
- printf("Enter the diagonal : ");
- scanf("%lf", &d);
- side = d / sqrt (2);
- area = side * side;
- per = 4 * side;
- printf("\nArea of the Square : %lf"
- "\nPerimeter of the Square : %lf", area, per);
- return 0;
-}
-
-/* --- End of tuition-c/P014.c --- */
-
-// File: tuition-c/P015.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P015.c
-
-/*WAP to accept number of days and
-display it after converting into
-number of years, months and days */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-int main() {
- int day, month, year, temp;
- printf("Enter the number of days : ");
- scanf("%d", &day);
- temp = day;
- year = day / 365;
- day = day % 365;
- month = day / 30;
- day = day % 30;
- printf("\n%d Days = %d Years %d Months %d Days", temp, year, month, day);
- return 0;
-}
-
-/* --- End of tuition-c/P015.c --- */
-
-// File: tuition-c/P016.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P016.c
-
-/* WAP to calculate and display radius of a
-circle by taking the area as input */
-// Author - Amit Dutta, Date - Unknown
-
-#include<stdio.h>
-#include<math.h>
-int main() {
- double area, r;
- printf("Enter the area of a circle : ");
- scanf("%lf", &area);
- r = sqrt((7 * area) / 22);
- printf("\nRadius : %lf", r);
- return 0;
-}
-
-/* --- End of tuition-c/P016.c --- */
-
-// File: tuition-c/P017.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P017.c
-
-/* Find maximum between three number. */
-// Author - Amit Dutta, Date - Unknown
-
-#include <stdio.h>
-int main()
-{
- int a, b, c, max;
- printf("Enter the value for a, b, c : ");
- scanf("%d %d %d", &a, &b, &c);
- max = a;
- if (max < b)
- max = b;
- if (max < c)
- max = c;
- printf("Maximum : %d", max);
- return 0;
-}
-/* --- End of tuition-c/P017.c --- */
-
-// File: tuition-c/P018.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P018.c
-
-/* WAP to input the cost price and selling price and
-calculate profit, profit percentage, loss percentage or
-display the manage nither profit nor loss. */
-// Author - Amit Dutta, Date - Unknown
-
-#include <stdio.h>
-int main()
-{
- double cost, sell, pro, prop, loss, lossp;
- printf("Enter the cost and selling price : ");
- scanf("%lf %lf", &cost, &sell);
- if (sell > cost)
- {
- pro = sell - cost;
- prop = (pro / cost) * 100;
- printf("Profit : RS %g, Profit Percentage : %g", pro, prop);
- }
- else if (sell < cost)
- {
- loss = cost - sell;
- lossp = (loss / cost) * 100;
- printf("Loss : RS %g, Loss Percentage : %g", loss, lossp);
- }
- else
- printf("Neither loss nor Profit.");
- return 0;
-}
-/* --- End of tuition-c/P018.c --- */
-
-// File: tuition-c/P019.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P019.c
-
-/* WAP to input the distance covered and calculate
-the amount to be paid by the passanger.
- Distance Rate
- =<5KM RS 90
- next 10KM RS 20/KM
- next 10KM RS 10/KM
- more than 25KM RS 9/KM
-*/
-// Author - Amit Dutta, Date - Unknown
-
-#include <stdio.h>
-int main()
-{
- double dis, amt;
- printf("Enter the distance : ");
- scanf("%lf", &dis);
- if (dis <= 5.0)
- amt = 90.0;
- else if (dis > 5.0 && dis <= 15.0)
- amt = 90.0 + (dis - 5.0) * 20;
- else if (dis > 15.0 && dis <= 25.0)
- amt = 90.0 + 200.0 + (dis - 15.0) * 10;
- else if (dis > 25.0)
- amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9;
- printf("\nAmount to be paid : %g", amt);
- return 0;
-}
-/* --- End of tuition-c/P019.c --- */
-
-// File: tuition-c/P020.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P020.c
-
-/* WAP to calculate and display the maturity amount
-taking the sum and number of days as input.
- No. of Days Rate of Interest
- Upto 180 days 5.5 %
- 181 to 364 days 7.5 %
- exact 365 days 9.0 %
- more than 365 days 8.5 %
-*/
-// Author - Amit Dutta, Date - Unknown
-
-#include <stdio.h>
-int main()
-{
- double nod, amt, s, i;
- printf("Enter the amount and the time in days : ");
- scanf("%lf %lf", &s, &nod);
- if (nod <= 180)
- i = (s * 5.5 * (nod / 365)) / 100;
- else if (nod > 180.0 && nod <= 364.0)
- i = (s * 7.5 * (nod / 365)) / 100;
- else if (nod == 365.0)
- i = (s * 9.0 * 1) / 100;
- else if (nod > 365.0)
- i = (s * 8.5 * (nod / 365)) / 100;
- amt = s + i;
- printf("Amount to be paid : %g", amt);
- return 0;
-}
-/* --- End of tuition-c/P020.c --- */
-
-// File: tuition-c/P021.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P021.c
-
-/* WAP to input a positive number and check if it is a perfect
-square number or not. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-#include <math.h>
-int main()
-{
- int n, temp;
- double sr;
- printf("Enter the number : ");
- scanf("%d", &n);
- sr = sqrt(n);
- temp = (int)sr;
- if (temp * temp == n)
- printf("\nThis is a perfect square.");
- else
- printf("\nThis is not a perfect square.");
- return 0;
-}
-/* --- End of tuition-c/P021.c --- */
-
-// File: tuition-c/P022.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P022.c
-
-/* WAP to find out smallest of three numbers without using if_else block. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-int main()
-{
- int a, b, c, min;
- printf("Enter three number : ");
- scanf("%d %d %d", &a, &b, &c);
- min = (a < b && a < c) ? a : (b < a && b < c) ? b
- : c;
- printf("Minimum = %d", min);
- return 0;
-}
-/* --- End of tuition-c/P022.c --- */
-
-// File: tuition-c/P023.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P023.c
-
-/* WAP to input the total cost and compute the amount to be paid
-by the customer. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-int main()
-{
- double cost, amt;
- printf("Enter the total cost : ");
- scanf("%lf", &cost);
- if (cost <= 2000)
- amt = cost * 0.94;
- else if (cost > 2000 && cost <= 5000)
- amt = cost * 0.9;
- else if (cost > 5000 && cost <= 10000)
- amt = cost * 0.85;
- else if (cost > 10000)
- amt = cost * 0.8;
- printf("\nAmount to be paid : %g", amt);
- return 0;
-}
-/* --- End of tuition-c/P023.c --- */
-
-// File: tuition-c/P024.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P024.c
-
-/* WAP to check whether a year is leapyear or not. */
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-int main()
-{
- int year;
- printf("Enter the year : ");
- scanf("%d", &year);
- if (year % 4 == 0 && year % 100 != 0)
- printf("\nYear %d is a leapyear.", year);
- else if (year % 400 == 0)
- printf("\nYear %d is a leapyear (Century).", year);
- else
- printf("\nYear %d is not a leapyear.", year);
- return 0;
-}
-/* --- End of tuition-c/P024.c --- */
-
-// File: tuition-c/P025.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P025.c
-
-/* WAP to input the electricity unit consumed and calculate the total
-bill amount according to the given condition :
- for 1st 50 unit Rs. 0.50 per unit
- next 100 unit Rs. 0.75 per unit
- next 100 unit Rs. 1.20 per unit
- above 250 unit Rs. 1.50 per unit
-And additional charge of 20 percent is added to the bill.
-*/
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-int main()
-{
- double unit, amt;
- printf("Enter the electricity consp(unit) : ");
- scanf("%lf", &amt);
- if (unit <= 50)
- amt = unit * 0.50;
- else if (unit > 50 && unit <= 50)
- amt = 25 + ((unit - 50) * 0.75);
- else if (unit > 150 && unit <= 250)
- amt = 25 + 75 + ((unit - 150) * 1.20);
- else if (unit > 250)
- amt = 25 + 75 + 120 + ((unit - 250) * 1.50);
- amt = amt * 1.20;
- printf("\nAmount to be paid : %g", amt);
- return 0;
-}
-/* --- End of tuition-c/P025.c --- */
-
-// File: tuition-c/P026.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P026.c
-
-/* WAP to input sum (p), rate of interest (r), time (t) and type of interest
-('s' for simple interest amd 'c' for compound interest). Calculate and display
-the interest earned
- si = (p * r * t) / 100
- compoundInterest = p * ((1 + r / 100)^t - 1)
-*/
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-
-#include <stdio.h>
-#include <math.h>
-#include <ctype.h>
-int main()
-{
- double principalAmount, rateOfInterest, timePeriod, simpleInterest, compoundInterest;
- char mode;
- printf("Enter the principle amount, Rate of interest, Time : ");
- scanf("%lf %lf %lf", &principalAmount, &rateOfInterest, &timePeriod);
- printf("\nEnter the mode ('s' : simple interest, 'c' : compound interest) : ");
- scanf(" %c", &mode);
- mode = tolower(mode);
- switch (mode)
- {
- case 's':
- simpleInterest = (principalAmount * rateOfInterest * timePeriod) / 100;
- printf("\nSimple Interest : %g", simpleInterest);
- break;
- case 'c':
- compoundInterest = principalAmount * (pow((1 + rateOfInterest / 100), timePeriod) - 1);
- printf("\nCompound Interest : %g", compoundInterest);
- break;
- default:
- printf("\nInvalid Input");
- return 1;
- }
- return 0;
-}
-/* --- End of tuition-c/P026.c --- */
-
-// File: tuition-c/P027.c
-// URL: https://github.com/notamitgamer/bsc/blob/main/tuition-c/P027.c
-
-/* Purchase Discount on Discount on
- Amount Laptop Desktop
- -------- ----------- -----------
- Upto 20k 3.0% 5.0%
- 20001 - 50k 5.0% 7.5%
- 50001 - 75k 7.5% 10.5%
- more than 75k 10.0% 15.0%
-WAP to input amount of purchase and type of purchase ('L' : laptop, 'D' : desktop)
-and display the discount amount and the discounted price (Net Amount).
-*/
-/* Author - Amit Dutta, Date - 8th OCT, 2025 */
-// This code has not been compiled.
-// If you find any issues, please create a new issue on GitHub regarding them.
-
-#include <stdio.h>
-#include <ctype.h>
-int main()
-{
- double principal_amount, desktop_discount, laptop_discount, discount_amount, discounted_price;
- char choice;
- printf("Enter the purchase amount : ");
- scanf("%lf", &principal_amount);
- printf("Type of purchase ('L' : Laptop, 'D' : Desktop) : ");
- scanf(" %c", &choice);
- choice = toupper(choice);
- if (principal_amount <= 20000)
- {
- laptop_discount = 0.03;
- desktop_discount = 0.05;
- }
- else if (principal_amount > 20000 && principal_amount <= 50000)
- {
- laptop_discount = 0.05;
- desktop_discount = 0.075;
- }
- else if (principal_amount > 50000 && principal_amount <= 75000)
- {
- laptop_discount = 0.075;
- desktop_discount = 0.105;
- }
- else if (principal_amount > 75000)
- {
- laptop_discount = 0.1;
- desktop_discount = 0.15;
- }
- switch (choice)
- {
- case 'L':
- discount_amount = principal_amount * laptop_discount;
- discounted_price = principal_amount - discount_amount;
- printf("\nDiscount Amount : %g"
- "\nDiscounted Price : %g",
- discount_amount, discounted_price);
- break;
- case 'D':
- discount_amount = principal_amount * desktop_discount;
- discounted_price = principal_amount - discount_amount;
- printf("\nDiscount Amount : %g"
- "\nDiscounted Price : %g",
- discount_amount, discounted_price);
- break;
- default:
- printf("\nInvalid Input.");
- return 1;
- }
- return 0;
-}
-/* --- End of tuition-c/P027.c --- */-
\ No newline at end of file