bsc

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

commit 1260ee98e952d19e3cb5996569873d6da01f9f60
parent ac861c73e764c1adba12ad158518dd9db72c7dff
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Sun,  8 Feb 2026 15:50:35 +0530

[2026-02-08] : .\Semester_1\letusc : Automated Update: Source code for Chapter 10, 12, 13, 14, 15, 16

Diffstat:
ASemester_1/letusc/interest.h | 7+++++++
ASemester_1/letusc/luc049.c | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc050.c | 39+++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc051.c | 43+++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc052.c | 28++++++++++++++++++++++++++++
ASemester_1/letusc/luc053.c | 48++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc054.c | 37+++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc055.c | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc056.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc057.c | 49+++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc058.c | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc059.c | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc060.c | 48++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc061.c | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc062.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc063.c | 47+++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc064.c | 185+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc065.c | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc066.c | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc067.c | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc068.c | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc069.c | 38++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc070.c | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc071.c | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc072.c | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc073.c | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc074.c | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc075.c | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc076.c | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
ASemester_1/letusc/luc077.c | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdocs/index.html | 2154+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 files changed, 3886 insertions(+), 0 deletions(-)

diff --git a/Semester_1/letusc/interest.h b/Semester_1/letusc/interest.h @@ -0,0 +1,7 @@ +/* + * Author : Amit Dutta + * File : interest.h + */ + +#define SIMPLE_INTEREST(p, r, t) ((p * r * t) / 100.0) +#define AMOUNT(p, si) (p + si) diff --git a/Semester_1/letusc/luc049.c b/Semester_1/letusc/luc049.c @@ -0,0 +1,61 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* A positive integer is entered through the keyboard, write a function to find the binary equivalent of this number: +(1) Without using recursion +(2) Using recursion +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(a) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int binary_non_rec(int); +void binary_rec(int); + +int main() +{ + int num, bin; + + printf("Enter a positive integer: "); + scanf("%d", &num); + + bin = binary_non_rec(num); + printf("Binary (Non-Recursive): %d\n", bin); + + printf("Binary (Recursive): "); + binary_rec(num); + printf("\n"); + + return 0; +} + +int binary_non_rec(int n) +{ + int rem, i = 1, bin = 0; + while (n != 0) + { + rem = n % 2; + n = n / 2; + bin = bin + rem * i; + i = i * 10; + } + return bin; +} + +void binary_rec(int n) +{ + if (n > 1) + binary_rec(n / 2); + + printf("%d", n % 2); +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc050.c b/Semester_1/letusc/luc050.c @@ -0,0 +1,38 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a recursive function to obtain the sum of first 25 natural numbers. +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(b) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int get_sum(int); + +int main() +{ + int n = 25, sum; + + sum = get_sum(n); + printf("Sum of first %d natural numbers is: %d\n", n, sum); + + return 0; +} + +int get_sum(int n) +{ + if (n == 0) + return 0; + else + return n + get_sum(n - 1); +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc051.c b/Semester_1/letusc/luc051.c @@ -0,0 +1,42 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Tower of Hanoi: Write a program to print out the sequence in which 4 disks should be moved from peg A to peg C using peg B. +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(c) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +void hanoi(int, char, char, char); + +int main() +{ + int n = 4; + + printf("Sequence of moves for %d disks:\n\n", n); + hanoi(n, 'A', 'B', 'C'); + + return 0; +} + +void hanoi(int n, char from_rod, char aux_rod, char to_rod) +{ + if (n == 1) + { + printf("Move disk 1 from rod %c to rod %c\n", from_rod, to_rod); + return; + } + hanoi(n - 1, from_rod, to_rod, aux_rod); + printf("Move disk %d from rod %c to rod %c\n", n, from_rod, to_rod); + hanoi(n - 1, aux_rod, from_rod, to_rod); +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc052.c b/Semester_1/letusc/luc052.c @@ -0,0 +1,27 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If a macro is not getting expanded as per your expectation, how will you find out how is it being expanded by the preprocessor? +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(a) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + printf("To see how macros are expanded, use the compiler flag '-E'.\n"); + printf("Command: gcc -E filename.c\n"); + printf("This outputs the file after preprocessing stage.\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc053.c b/Semester_1/letusc/luc053.c @@ -0,0 +1,47 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write macro definitions for: Mean, Absolute value, Uppercase to Lowercase, Biggest of three. +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(b) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +#define MEAN(x, y) ((x + y) / 2.0) +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define TO_LOWER(x) ((x) >= 'A' && (x) <= 'Z' ? (x) + 32 : (x)) +#define MAX(x, y, z) ((x) > (y) ? ((x) > (z) ? (x) : (z)) : ((y) > (z) ? (y) : (z))) + +int main() +{ + int a, b, c, num; + char ch; + + printf("Enter two numbers for Mean: "); + scanf("%d %d", &a, &b); + printf("Mean: %.2f\n\n", MEAN(a, b)); + + printf("Enter a number for Absolute value: "); + scanf("%d", &num); + printf("Absolute: %d\n\n", ABS(num)); + + printf("Enter an uppercase character: "); + scanf(" %c", &ch); + printf("Lowercase: %c\n\n", TO_LOWER(ch)); + + printf("Enter three numbers: "); + scanf("%d %d %d", &a, &b, &c); + printf("Biggest: %d\n", MAX(a, b, c)); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc054.c b/Semester_1/letusc/luc054.c @@ -0,0 +1,36 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Use 'interest.h' macros to calculate Simple Interest and Amount. +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(c) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +#include "interest.h" + +int main() +{ + float p, r, t, si, amt; + + printf("Enter Principal, Rate and Time: "); + scanf("%f %f %f", &p, &r, &t); + + si = SIMPLE_INTEREST(p, r, t); + amt = AMOUNT(p, si); + + printf("Simple Interest: %.2f\n", si); + printf("Total Amount: %.2f\n", amt); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc055.c b/Semester_1/letusc/luc055.c @@ -0,0 +1,50 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + int arr[25], i; + int pos = 0, neg = 0, even = 0, odd = 0; + + printf("Enter 25 integers:\n"); + for (i = 0; i < 25; i++) + { + scanf("%d", &arr[i]); + + if (arr[i] > 0) + pos++; + else if (arr[i] < 0) + neg++; + + if (arr[i] % 2 == 0) + even++; + else + odd++; + } + + printf("\nResults:\n"); + printf("Positive: %d\n", pos); + printf("Negative: %d\n", neg); + printf("Even: %d\n", even); + printf("Odd: %d\n", odd); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc056.c b/Semester_1/letusc/luc056.c @@ -0,0 +1,51 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + int arr[100], n, i, symmetric = 1; + + printf("Enter number of elements (n): "); + scanf("%d", &n); + + printf("Enter %d elements: ", n); + for (i = 0; i < n; i++) + { + scanf("%d", &arr[i]); + } + + // Check symmetry + for (i = 0; i < n / 2; i++) + { + if (arr[i] != arr[n - 1 - i]) + { + symmetric = 0; + break; + } + } + + if (symmetric) + printf("\nThe array is symmetric (Palindrome).\n"); + else + printf("\nThe array is NOT symmetric.\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc057.c b/Semester_1/letusc/luc057.c @@ -0,0 +1,48 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program using pointers to find the smallest number in an array of 25 integers. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + int arr[25], i, min; + int *ptr; + + printf("Enter 25 integers:\n"); + for (i = 0; i < 25; i++) + { + scanf("%d", &arr[i]); + } + + ptr = arr; // Point to start of array + min = *ptr; // Initialize min with first element + + for (i = 1; i < 25; i++) + { + ptr++; // Move pointer to next element + if (*ptr < min) + { + min = *ptr; + } + } + + printf("\nSmallest number is: %d\n", min); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc058.c b/Semester_1/letusc/luc058.c @@ -0,0 +1,63 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Implement the Insertion Sort algorithm shown in Figure 13.3 on a set of 25 numbers. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(d) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +void insertion_sort(int *, int); + +int main() +{ + int arr[25], i; + + printf("Enter 25 integers for Insertion Sort:\n"); + for (i = 0; i < 25; i++) + { + scanf("%d", &arr[i]); + } + + insertion_sort(arr, 25); + + printf("\nSorted Array:\n"); + for (i = 0; i < 25; i++) + { + printf("%d ", arr[i]); + } + printf("\n"); + + return 0; +} + +void insertion_sort(int *arr, int n) +{ + int i, j, key; + for (i = 1; i < n; i++) + { + key = arr[i]; + j = i - 1; + + /* Move elements of arr[0..i-1], that are greater than key, + to one position ahead of their current position */ + while (j >= 0 && arr[j] > key) + { + arr[j + 1] = arr[j]; + j = j - 1; + } + arr[j + 1] = key; + } +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc059.c b/Semester_1/letusc/luc059.c @@ -0,0 +1,50 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program which initializes an integer array of 10 elements in main(), passes it to modify(), multiplies each element by 3, and prints the new array in main(). +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +void modify(int *, int); + +int main() +{ + int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + int i; + + printf("Original Array:\n"); + for (i = 0; i < 10; i++) + printf("%d ", arr[i]); + + modify(arr, 10); + + printf("\n\nModified Array (x3):\n"); + for (i = 0; i < 10; i++) + printf("%d ", arr[i]); + printf("\n"); + + return 0; +} + +void modify(int *a, int n) +{ + int i; + for (i = 0; i < n; i++) + { + a[i] = a[i] * 3; + } +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc060.c b/Semester_1/letusc/luc060.c @@ -0,0 +1,47 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* For the following set of sample data, compute the standard deviation and the mean.\nData: -6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2 +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + int data[] = {-6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2}; + int n = 15, i; + double sum = 0.0, mean, std_dev = 0.0; + + // Calculate Mean + for (i = 0; i < n; i++) + { + sum += data[i]; + } + mean = sum / n; + + // Calculate Standard Deviation + for (i = 0; i < n; i++) + { + std_dev += pow(data[i] - mean, 2); + } + std_dev = sqrt(std_dev / n); + + printf("Count: %d\n", n); + printf("Mean: %.2f\n", mean); + printf("Standard Deviation: %.2f\n", std_dev); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc061.c b/Semester_1/letusc/luc061.c @@ -0,0 +1,52 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* The area of a triangle can be computed by the sine law. Given 6 triangular pieces of land (a, b, angle), find their area and determine which is largest. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(g) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + // Data arrays + double a[] = {137.4, 155.2, 149.3, 160.0, 155.6, 149.7}; + double b[] = {80.9, 92.62, 97.93, 100.25, 68.95, 120.0}; + double angle[] = {0.78, 0.89, 1.35, 9.00, 1.25, 1.75}; // Assuming radians based on values < 2.0. 9.00 is treated as literal. + + double area, max_area = 0.0; + int i, max_index = -1; + + printf("Plot No.\tArea\n"); + printf("------------------------\n"); + + for (i = 0; i < 6; i++) + { + // Area = 1/2 * a * b * sin(angle) + area = 0.5 * a[i] * b[i] * sin(angle[i]); + + printf("%d\t\t%.2f\n", i + 1, area); + + if (area > max_area) + { + max_area = area; + max_index = i + 1; + } + } + + printf("\nLargest Plot is No. %d with Area: %.2f\n", max_index, max_area); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc062.c b/Semester_1/letusc/luc062.c @@ -0,0 +1,51 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* For the following set of n data points (x, y), write a program to compute the correlation coefficient r. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(h) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + double x[] = {34.22, 39.87, 41.85, 43.23, 40.06, 53.29, 53.29, 54.14, 49.12, 40.71, 55.15}; + double y[] = {102.43, 100.93, 97.43, 97.81, 98.32, 98.32, 100.07, 97.08, 91.59, 94.85, 94.65}; + + int n = 11, i; + double sum_x = 0, sum_y = 0, sum_xy = 0, sum_x2 = 0, sum_y2 = 0; + double numerator, denominator, r; + + for (i = 0; i < n; i++) + { + sum_x += x[i]; + sum_y += y[i]; + sum_xy += x[i] * y[i]; + sum_x2 += x[i] * x[i]; + sum_y2 += y[i] * y[i]; + } + + numerator = (n * sum_xy) - (sum_x * sum_y); + denominator = sqrt((n * sum_x2 - sum_x * sum_x) * (n * sum_y2 - sum_y * sum_y)); + + if (denominator != 0) + r = numerator / denominator; + else + r = 0; // Avoid division by zero + + printf("Correlation coefficient (r) = %.4f\n", r); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc063.c b/Semester_1/letusc/luc063.c @@ -0,0 +1,46 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* The X and Y coordinates of 10 different points are entered through the keyboard. Write a program to find the distance of last point from the first point (sum of distances between consecutive points). +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(i) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +int main() +{ + double x[10], y[10]; + double total_distance = 0.0; + int i; + + printf("Enter coordinates (x, y) for 10 points:\n"); + for (i = 0; i < 10; i++) + { + printf("Point %d: ", i + 1); + scanf("%lf %lf", &x[i], &y[i]); + } + + // Sum of distances between consecutive points P(i) and P(i+1) + for (i = 0; i < 9; i++) + { + double dx = x[i+1] - x[i]; + double dy = y[i+1] - y[i]; + total_distance += sqrt(dx*dx + dy*dy); + } + + printf("\nTotal distance from first to last point: %.2f\n", total_distance); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc064.c b/Semester_1/letusc/luc064.c @@ -0,0 +1,184 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Simulate a Dequeue (Double Ended Queue) using an array. Support: retrieve left, retrieve right, insert left, insert right. Use pointers left and right. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(j) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> + +#define MAX 10 + +void insert_left(int *, int *, int *, int); +void insert_right(int *, int *, int *, int); +void retrieve_left(int *, int *, int *); +void retrieve_right(int *, int *, int *); +void display(int *, int, int); + +int main() +{ + int dq[MAX]; + int left = -1, right = -1; + int choice, val; + + while (1) + { + printf("\n--- Dequeue Menu ---\n"); + printf("1. Insert Left\n2. Insert Right\n"); + printf("3. Retrieve Left\n4. Retrieve Right\n"); + printf("5. Display\n6. Exit\n"); + printf("Enter choice: "); + scanf("%d", &choice); + + switch (choice) + { + case 1: + printf("Enter value: "); + scanf("%d", &val); + insert_left(dq, &left, &right, val); + break; + case 2: + printf("Enter value: "); + scanf("%d", &val); + insert_right(dq, &left, &right, val); + break; + case 3: + retrieve_left(dq, &left, &right); + break; + case 4: + retrieve_right(dq, &left, &right); + break; + case 5: + display(dq, left, right); + break; + case 6: + exit(0); + default: + printf("Invalid choice!\n"); + } + } + return 0; +} + +void insert_left(int *dq, int *left, int *right, int val) +{ + // Check if full + if ((*left == 0 && *right == MAX - 1) || (*left == *right + 1)) + { + printf("Overflow! Dequeue is full.\n"); + return; + } + + if (*left == -1) // Initially empty + { + *left = 0; + *right = 0; + } + else if (*left == 0) // Wrap around + *left = MAX - 1; + else + (*left)--; + + dq[*left] = val; + printf("Inserted %d at Left.\n", val); +} + +void insert_right(int *dq, int *left, int *right, int val) +{ + if ((*left == 0 && *right == MAX - 1) || (*left == *right + 1)) + { + printf("Overflow! Dequeue is full.\n"); + return; + } + + if (*left == -1) // Initially empty + { + *left = 0; + *right = 0; + } + else if (*right == MAX - 1) // Wrap around + *right = 0; + else + (*right)++; + + dq[*right] = val; + printf("Inserted %d at Right.\n", val); +} + +void retrieve_left(int *dq, int *left, int *right) +{ + if (*left == -1) + { + printf("Underflow! Dequeue is empty.\n"); + return; + } + + printf("Retrieved from Left: %d\n", dq[*left]); + + if (*left == *right) // Only one element was present + { + *left = -1; + *right = -1; + } + else if (*left == MAX - 1) + *left = 0; + else + (*left)++; +} + +void retrieve_right(int *dq, int *left, int *right) +{ + if (*left == -1) + { + printf("Underflow! Dequeue is empty.\n"); + return; + } + + printf("Retrieved from Right: %d\n", dq[*right]); + + if (*left == *right) // Only one element was present + { + *left = -1; + *right = -1; + } + else if (*right == 0) + *right = MAX - 1; + else + (*right)--; +} + +void display(int *dq, int left, int right) +{ + int i; + if (left == -1) + { + printf("Dequeue is Empty\n"); + return; + } + + printf("Elements: "); + i = left; + while (1) + { + printf("%d ", dq[i]); + if (i == right) + break; + if (i == MAX - 1) + i = 0; + else + i++; + } + printf("\n"); +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc065.c b/Semester_1/letusc/luc065.c @@ -0,0 +1,59 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to find if a square matrix is symmetric. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + int mat[10][10], n, i, j; + int is_symmetric = 1; + + printf("Enter the size of the square matrix (max 10): "); + scanf("%d", &n); + + printf("Enter elements of the %dx%d matrix:\n", n, n); + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + scanf("%d", &mat[i][j]); + } + } + + // Check for symmetry: mat[i][j] must equal mat[j][i] + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + if (mat[i][j] != mat[j][i]) + { + is_symmetric = 0; + break; + } + } + if (is_symmetric == 0) + break; + } + + if (is_symmetric) + printf("\nThe matrix is Symmetric.\n"); + else + printf("\nThe matrix is NOT Symmetric.\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc066.c b/Semester_1/letusc/luc066.c @@ -0,0 +1,59 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to add two 6 x 6 matrices. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + int mat1[6][6], mat2[6][6], sum[6][6]; + int i, j; + + // Initializing matrices with some values automatically + // to avoid asking user to enter 72 numbers. + printf("Initializing two 6x6 matrices with sample data...\n"); + + for (i = 0; i < 6; i++) + { + for (j = 0; j < 6; j++) + { + mat1[i][j] = i + j; // Example data + mat2[i][j] = i * j; // Example data + } + } + + // Adding matrices + for (i = 0; i < 6; i++) + { + for (j = 0; j < 6; j++) + { + sum[i][j] = mat1[i][j] + mat2[i][j]; + } + } + + printf("\nSum of the two 6x6 matrices:\n"); + for (i = 0; i < 6; i++) + { + for (j = 0; j < 6; j++) + { + printf("%4d ", sum[i][j]); + } + printf("\n"); + } + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc067.c b/Semester_1/letusc/luc067.c @@ -0,0 +1,64 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to multiply any two 3 x 3 matrices. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(g) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + int mat1[3][3], mat2[3][3], res[3][3]; + int i, j, k; + + printf("Enter elements of first 3x3 matrix:\n"); + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + scanf("%d", &mat1[i][j]); + + printf("Enter elements of second 3x3 matrix:\n"); + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + scanf("%d", &mat2[i][j]); + + // Initialize result matrix to 0 + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + res[i][j] = 0; + + // Multiplication Logic + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + for (k = 0; k < 3; k++) + { + res[i][j] += mat1[i][k] * mat2[k][j]; + } + } + } + + printf("\nResult of Multiplication:\n"); + for (i = 0; i < 3; i++) + { + for (j = 0; j < 3; j++) + { + printf("%4d ", res[i][j]); + } + printf("\n"); + } + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc068.c b/Semester_1/letusc/luc068.c @@ -0,0 +1,78 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Given an array p[5], write a function to shift it circularly left by two positions. Call this function for a 4 x 5 matrix and get its rows left shifted. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(h) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <stdlib.h> + +void shift_left_two(int *p, int n); +void print_row(int *p, int n); + +int main() +{ + int mat[4][5] = { + {15, 30, 28, 19, 61}, + {1, 2, 3, 4, 5}, + {10, 20, 30, 40, 50}, + {5, 4, 3, 2, 1} + }; + int i; + + printf("Original Matrix:\n"); + for (i = 0; i < 4; i++) + print_row(mat[i], 5); + + // Apply shift to each row + for (i = 0; i < 4; i++) + { + shift_left_two(mat[i], 5); + } + + printf("\nMatrix after shifting each row left by 2:\n"); + for (i = 0; i < 4; i++) + print_row(mat[i], 5); + + return 0; +} + +void shift_left_two(int *p, int n) +{ + if (n < 2) return; // Cannot shift if less than 2 elements + + int temp1 = p[0]; + int temp2 = p[1]; + int i; + + // Shift elements left by 2 + for (i = 0; i < n - 2; i++) + { + p[i] = p[i + 2]; + } + + // Place the first two elements at the end + p[n - 2] = temp1; + p[n - 1] = temp2; +} + +void print_row(int *p, int n) +{ + int i; + for (i = 0; i < n; i++) + { + printf("%d ", p[i]); + } + printf("\n"); +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc069.c b/Semester_1/letusc/luc069.c @@ -0,0 +1,37 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If the string "Alice in wonder land" is fed to the following scanf() statement, what will be the contents of arrays str1, str2, str3 and str4? +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +int main() +{ + char str1[20], str2[20], str3[20], str4[20]; + + printf("Enter the string 'Alice in wonder land': "); + /* scanf stops reading at the first whitespace character for %s */ + scanf("%s%s%s%s", str1, str2, str3, str4); + + printf("\nContents of arrays:\n"); + printf("str1: %s\n", str1); + printf("str2: %s\n", str2); + printf("str3: %s\n", str3); + printf("str4: %s\n", str4); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc070.c b/Semester_1/letusc/luc070.c @@ -0,0 +1,60 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives a 10-digit ISBN number, computes the checksum (d1 + 2d2 + 3d3 + ... + 10d10), and reports whether the ISBN number is correct (sum divisible by 11). +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +int main() +{ + char isbn[15]; + int i, sum = 0, digit; + + printf("Enter 10-digit ISBN number: "); + scanf("%s", isbn); + + /* The formula given is: d1 + 2d2 + 3d3 + ... + 10d10 + where di is the ith digit from the RIGHT. + + If input is "007462542X" (Length 10): + isbn[0] is d10 (Weight 10) + isbn[1] is d9 (Weight 9) + ... + isbn[9] is d1 (Weight 1) + */ + + for (i = 0; i < 10; i++) + { + // Handle 'X' which represents 10 in ISBN + if (isbn[i] == 'X' || isbn[i] == 'x') + digit = 10; + else + digit = isbn[i] - '0'; + + // Weight is (10 - i) + sum += digit * (10 - i); + } + + printf("Calculated Checksum: %d\n", sum); + + if (sum % 11 == 0) + printf("The ISBN number is Correct.\n"); + else + printf("The ISBN number is Incorrect.\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc071.c b/Semester_1/letusc/luc071.c @@ -0,0 +1,64 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives a 16-digit Credit Card number and checks whether it is valid using the Luhn algorithm variant described. +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +int main() +{ + char card[20]; + int i, digit, sum = 0; + + printf("Enter 16-digit Credit Card number: "); + scanf("%s", card); + + /* Rule: + 1. Start with rightmost-1 digit (index 14) and multiply every other digit by 2. + (These are indices 0, 2, 4, ..., 14) + 2. Subtract 9 if result >= 10. + 3. Add these results. + 4. Add remaining digits (indices 1, 3, ..., 15). + 5. If total sum is divisible by 10, it is valid. + */ + + for (i = 0; i < 16; i++) + { + digit = card[i] - '0'; + + if (i % 2 == 0) // Indices 0, 2, 4... (Every other starting from left, which hits rightmost-1) + { + digit = digit * 2; + if (digit >= 10) + { + digit = digit - 9; + } + } + + // Add to total sum (both modified and unmodified digits) + sum += digit; + } + + printf("Total Sum: %d\n", sum); + + if (sum % 10 == 0) + printf("The Credit Card number is Valid.\n"); + else + printf("The Credit Card number is Invalid.\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc072.c b/Semester_1/letusc/luc072.c @@ -0,0 +1,67 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* How many bytes in memory would be occupied by the following array of pointers to strings? How many bytes would be required to store the same strings in a two-dimensional character array? +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +int main() +{ + /* Question Analysis: + char *mess[] = {"Hammer and tongs", "Tooth and nail", "Spit and polish", "You and C"}; + + 1. Array of Pointers (*mess[]): + - It stores 4 pointers. + - Size of a pointer is typically 4 bytes (32-bit) or 8 bytes (64-bit). + - Total = 4 * sizeof(char*) + - Plus the strings themselves are stored elsewhere in memory. + + 2. Two-Dimensional Array (mess[][]): + - Must accommodate the longest string ("Hammer and tongs" = 16 chars + null = 17). + - Width would be 17 (or more). + - Size = 4 rows * 17 cols * 1 byte. + */ + + char *mess_ptr[] = { + "Hammer and tongs", + "Tooth and nail", + "Spit and polish", + "You and C" + }; + + // Longest string length + 1 for null terminator + // "Hammer and tongs" is 16 chars long. + char mess_2d[4][17] = { + "Hammer and tongs", + "Tooth and nail", + "Spit and polish", + "You and C" + }; + + printf("--- Memory Occupation Analysis ---\n\n"); + + printf("1. Array of Pointers (char *mess[]):\n"); + printf(" Size of array object itself (4 pointers): %zu bytes\n", sizeof(mess_ptr)); + printf(" (Note: The string literals are stored in read-only memory separately)\n\n"); + + printf("2. Two-Dimensional Array (char mess[4][17]):\n"); + printf(" Size of 2D array: %zu bytes\n", sizeof(mess_2d)); + printf(" (Calculation: 4 rows * 17 columns * 1 byte)\n"); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc073.c b/Semester_1/letusc/luc073.c @@ -0,0 +1,50 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +int main() +{ + char str[81], res[81]; + int i, j = 0; + + printf("Enter a sentence (max 80 chars): "); + gets(str); // Note: gets is deprecated, but used here for simplicity as per classic C texts + + for (i = 0; str[i] != '\0'; i++) + { + char ch = tolower(str[i]); + if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') + { + // Skip vowel + continue; + } + else + { + res[j] = str[i]; + j++; + } + } + res[j] = '\0'; + + printf("Sentence without vowels: %s\n", res); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc074.c b/Semester_1/letusc/luc074.c @@ -0,0 +1,61 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that will read a line and delete from it all occurrences of the word 'the'. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +int main() +{ + char str[100], res[100]; + int i = 0, j = 0; + + printf("Enter a line of text: "); + gets(str); + + while (str[i] != '\0') + { + /* Check if the current segment matches "the" */ + /* To be a word 'the', it should effectively be surrounded by non-alphabets or start/end of string. + For simplicity in this context, we check if str[i..] starts with "the" */ + + if ((str[i] == 't' || str[i] == 'T') && + (str[i+1] == 'h' || str[i+1] == 'H') && + (str[i+2] == 'e' || str[i+2] == 'E') && + (str[i+3] == ' ' || str[i+3] == '\0')) + { + // Found "the" followed by space or null. Skip "the". + i += 3; + + // If it was followed by a space, we might want to skip the space too + // to avoid double spaces, but the problem says delete 'the'. + // Let's just skip the word. + } + else + { + res[j] = str[i]; + j++; + i++; + } + } + res[j] = '\0'; + + printf("Text after removing 'the': %s\n", res); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc075.c b/Semester_1/letusc/luc075.c @@ -0,0 +1,78 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that stores a set of names of individuals and abbreviates the first and middle name to their first letter. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(d) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +int main() +{ + char names[5][50]; + char abbr[50]; + int i, j, k, len, space_count; + + printf("Enter 5 full names (First Middle Last):\n"); + for (i = 0; i < 5; i++) + { + printf("Name %d: ", i + 1); + gets(names[i]); + } + + printf("\nAbbreviated Names:\n"); + for (i = 0; i < 5; i++) + { + len = strlen(names[i]); + space_count = 0; + k = 0; + + // Add first initial + abbr[k++] = names[i][0]; + abbr[k++] = '.'; + abbr[k++] = ' '; + + // Find spaces to get subsequent parts + for (j = 0; j < len; j++) + { + if (names[i][j] == ' ') + { + space_count++; + if (space_count == 1) // Found start of Middle name + { + abbr[k++] = names[i][j+1]; + abbr[k++] = '.'; + abbr[k++] = ' '; + } + else if (space_count == 2) // Found start of Last name + { + // Copy the rest of the last name + int m = j + 1; + while (names[i][m] != '\0') + { + abbr[k++] = names[i][m++]; + } + // Stop searching + break; + } + } + } + abbr[k] = '\0'; + printf("%s\n", abbr); + } + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc076.c b/Semester_1/letusc/luc076.c @@ -0,0 +1,50 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to count the number of occurrences of any two vowels in succession in a line of text. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +int is_vowel(char c) +{ + c = tolower(c); + return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); +} + +int main() +{ + char str[100]; + int i, count = 0; + + printf("Enter a line of text: "); + gets(str); + + printf("Occurrences found:\n"); + for (i = 0; str[i] != '\0'; i++) + { + if (is_vowel(str[i]) && is_vowel(str[i+1])) + { + printf("'%c%c' ", str[i], str[i+1]); + count++; + } + } + + printf("\n\nTotal number of successive vowels: %d\n", count); + + return 0; +}+ \ No newline at end of file diff --git a/Semester_1/letusc/luc077.c b/Semester_1/letusc/luc077.c @@ -0,0 +1,76 @@ +/* + * Author : Amit Dutta <amitdutta4255@gmail.com> + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives an integer (less than or equal to nine digits in length) and prints out the number in words. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> + +void convert(long, char *); + +char *one[] = { + "", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ", + "Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", + "Seventeen ", "Eighteen ", "Nineteen " +}; + +char *ten[] = { + "", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " +}; + +int main() +{ + long num; + + printf("Enter a number (max 9 digits): "); + scanf("%ld", &num); + + if (num <= 0) + { + printf("Zero\n"); + } + else + { + printf("In words: "); + // Indian System: Crore, Lakh, Thousand, Hundred + convert((num / 10000000), "Crore "); + convert(((num / 100000) % 100), "Lakh "); + convert(((num / 1000) % 100), "Thousand "); + convert(((num / 100) % 10), "Hundred "); + convert((num % 100), ""); + printf("\n"); + } + + return 0; +} + +void convert(long n, char *suffix) +{ + if (n > 19) + { + printf("%s%s", ten[n / 10], one[n % 10]); + } + else + { + printf("%s", one[n]); + } + + if (n > 0) + { + printf("%s", suffix); + } +}+ \ No newline at end of file diff --git a/docs/index.html b/docs/index.html @@ -6111,6 +6111,29 @@ if __name__ == &quot;__main__&quot;: <div class="hidden pl-4 mt-1 border-l-2 border-slate-100 ml-3.5"> <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-interest-h', 'interest.h', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/interest.h')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">interest.h</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/interest.h" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-interest-h" style="display:none;">/* + * Author : Amit Dutta + * File : interest.h + */ + +#define SIMPLE_INTEREST(p, r, t) ((p * r * t) / 100.0) +#define AMOUNT(p, si) (p + si) +</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc001-c', 'luc001.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc001.c')"> <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> @@ -9159,6 +9182,2137 @@ Test Point (101.1, 201.2) is inside ABC. </div> <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc049-c', 'luc049.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc049.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc049.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc049.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc049-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* A positive integer is entered through the keyboard, write a function to find the binary equivalent of this number: +(1) Without using recursion +(2) Using recursion +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(a) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int binary_non_rec(int); +void binary_rec(int); + +int main() +{ + int num, bin; + + printf(&quot;Enter a positive integer: &quot;); + scanf(&quot;%d&quot;, &amp;num); + + bin = binary_non_rec(num); + printf(&quot;Binary (Non-Recursive): %d\n&quot;, bin); + + printf(&quot;Binary (Recursive): &quot;); + binary_rec(num); + printf(&quot;\n&quot;); + + return 0; +} + +int binary_non_rec(int n) +{ + int rem, i = 1, bin = 0; + while (n != 0) + { + rem = n % 2; + n = n / 2; + bin = bin + rem * i; + i = i * 10; + } + return bin; +} + +void binary_rec(int n) +{ + if (n &gt; 1) + binary_rec(n / 2); + + printf(&quot;%d&quot;, n % 2); +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc050-c', 'luc050.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc050.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc050.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc050.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc050-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a recursive function to obtain the sum of first 25 natural numbers. +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(b) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int get_sum(int); + +int main() +{ + int n = 25, sum; + + sum = get_sum(n); + printf(&quot;Sum of first %d natural numbers is: %d\n&quot;, n, sum); + + return 0; +} + +int get_sum(int n) +{ + if (n == 0) + return 0; + else + return n + get_sum(n - 1); +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc051-c', 'luc051.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc051.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc051.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc051.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc051-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Tower of Hanoi: Write a program to print out the sequence in which 4 disks should be moved from peg A to peg C using peg B. +*/ +/* Let Us C, Chap- 10 (Recursive), Qn No.: B(c) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +void hanoi(int, char, char, char); + +int main() +{ + int n = 4; + + printf(&quot;Sequence of moves for %d disks:\n\n&quot;, n); + hanoi(n, &#x27;A&#x27;, &#x27;B&#x27;, &#x27;C&#x27;); + + return 0; +} + +void hanoi(int n, char from_rod, char aux_rod, char to_rod) +{ + if (n == 1) + { + printf(&quot;Move disk 1 from rod %c to rod %c\n&quot;, from_rod, to_rod); + return; + } + hanoi(n - 1, from_rod, to_rod, aux_rod); + printf(&quot;Move disk %d from rod %c to rod %c\n&quot;, n, from_rod, to_rod); + hanoi(n - 1, aux_rod, from_rod, to_rod); +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc052-c', 'luc052.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc052.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc052.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc052.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc052-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If a macro is not getting expanded as per your expectation, how will you find out how is it being expanded by the preprocessor? +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(a) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + printf(&quot;To see how macros are expanded, use the compiler flag &#x27;-E&#x27;.\n&quot;); + printf(&quot;Command: gcc -E filename.c\n&quot;); + printf(&quot;This outputs the file after preprocessing stage.\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc053-c', 'luc053.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc053.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc053.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc053.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc053-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write macro definitions for: Mean, Absolute value, Uppercase to Lowercase, Biggest of three. +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(b) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +#define MEAN(x, y) ((x + y) / 2.0) +#define ABS(x) ((x) &lt; 0 ? -(x) : (x)) +#define TO_LOWER(x) ((x) &gt;= &#x27;A&#x27; &amp;&amp; (x) &lt;= &#x27;Z&#x27; ? (x) + 32 : (x)) +#define MAX(x, y, z) ((x) &gt; (y) ? ((x) &gt; (z) ? (x) : (z)) : ((y) &gt; (z) ? (y) : (z))) + +int main() +{ + int a, b, c, num; + char ch; + + printf(&quot;Enter two numbers for Mean: &quot;); + scanf(&quot;%d %d&quot;, &amp;a, &amp;b); + printf(&quot;Mean: %.2f\n\n&quot;, MEAN(a, b)); + + printf(&quot;Enter a number for Absolute value: &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;Absolute: %d\n\n&quot;, ABS(num)); + + printf(&quot;Enter an uppercase character: &quot;); + scanf(&quot; %c&quot;, &amp;ch); + printf(&quot;Lowercase: %c\n\n&quot;, TO_LOWER(ch)); + + printf(&quot;Enter three numbers: &quot;); + scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c); + printf(&quot;Biggest: %d\n&quot;, MAX(a, b, c)); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc054-c', 'luc054.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc054.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc054.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc054.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc054-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Use &#x27;interest.h&#x27; macros to calculate Simple Interest and Amount. +*/ +/* Let Us C, Chap- 12 (The C Preprocessor), Qn No.: C(c) */ +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +#include &quot;interest.h&quot; + +int main() +{ + float p, r, t, si, amt; + + printf(&quot;Enter Principal, Rate and Time: &quot;); + scanf(&quot;%f %f %f&quot;, &amp;p, &amp;r, &amp;t); + + si = SIMPLE_INTEREST(p, r, t); + amt = AMOUNT(p, si); + + printf(&quot;Simple Interest: %.2f\n&quot;, si); + printf(&quot;Total Amount: %.2f\n&quot;, amt); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc055-c', 'luc055.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc055.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc055.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc055.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc055-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Twenty-five numbers are entered from the keyboard into an array. Write a program to find out how many of them are positive, how many are negative, how many are even and how many odd. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int arr[25], i; + int pos = 0, neg = 0, even = 0, odd = 0; + + printf(&quot;Enter 25 integers:\n&quot;); + for (i = 0; i &lt; 25; i++) + { + scanf(&quot;%d&quot;, &amp;arr[i]); + + if (arr[i] &gt; 0) + pos++; + else if (arr[i] &lt; 0) + neg++; + + if (arr[i] % 2 == 0) + even++; + else + odd++; + } + + printf(&quot;\nResults:\n&quot;); + printf(&quot;Positive: %d\n&quot;, pos); + printf(&quot;Negative: %d\n&quot;, neg); + printf(&quot;Even: %d\n&quot;, even); + printf(&quot;Odd: %d\n&quot;, odd); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc056-c', 'luc056.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc056.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc056.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc056.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc056-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int arr[100], n, i, symmetric = 1; + + printf(&quot;Enter number of elements (n): &quot;); + scanf(&quot;%d&quot;, &amp;n); + + printf(&quot;Enter %d elements: &quot;, n); + for (i = 0; i &lt; n; i++) + { + scanf(&quot;%d&quot;, &amp;arr[i]); + } + + // Check symmetry + for (i = 0; i &lt; n / 2; i++) + { + if (arr[i] != arr[n - 1 - i]) + { + symmetric = 0; + break; + } + } + + if (symmetric) + printf(&quot;\nThe array is symmetric (Palindrome).\n&quot;); + else + printf(&quot;\nThe array is NOT symmetric.\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc057-c', 'luc057.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc057.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc057.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc057.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc057-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program using pointers to find the smallest number in an array of 25 integers. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int arr[25], i, min; + int *ptr; + + printf(&quot;Enter 25 integers:\n&quot;); + for (i = 0; i &lt; 25; i++) + { + scanf(&quot;%d&quot;, &amp;arr[i]); + } + + ptr = arr; // Point to start of array + min = *ptr; // Initialize min with first element + + for (i = 1; i &lt; 25; i++) + { + ptr++; // Move pointer to next element + if (*ptr &lt; min) + { + min = *ptr; + } + } + + printf(&quot;\nSmallest number is: %d\n&quot;, min); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc058-c', 'luc058.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc058.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc058.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc058.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc058-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Implement the Insertion Sort algorithm shown in Figure 13.3 on a set of 25 numbers. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(d) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +void insertion_sort(int *, int); + +int main() +{ + int arr[25], i; + + printf(&quot;Enter 25 integers for Insertion Sort:\n&quot;); + for (i = 0; i &lt; 25; i++) + { + scanf(&quot;%d&quot;, &amp;arr[i]); + } + + insertion_sort(arr, 25); + + printf(&quot;\nSorted Array:\n&quot;); + for (i = 0; i &lt; 25; i++) + { + printf(&quot;%d &quot;, arr[i]); + } + printf(&quot;\n&quot;); + + return 0; +} + +void insertion_sort(int *arr, int n) +{ + int i, j, key; + for (i = 1; i &lt; n; i++) + { + key = arr[i]; + j = i - 1; + + /* Move elements of arr[0..i-1], that are greater than key, + to one position ahead of their current position */ + while (j &gt;= 0 &amp;&amp; arr[j] &gt; key) + { + arr[j + 1] = arr[j]; + j = j - 1; + } + arr[j + 1] = key; + } +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc059-c', 'luc059.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc059.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc059.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc059.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc059-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program which initializes an integer array of 10 elements in main(), passes it to modify(), multiplies each element by 3, and prints the new array in main(). +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +void modify(int *, int); + +int main() +{ + int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + int i; + + printf(&quot;Original Array:\n&quot;); + for (i = 0; i &lt; 10; i++) + printf(&quot;%d &quot;, arr[i]); + + modify(arr, 10); + + printf(&quot;\n\nModified Array (x3):\n&quot;); + for (i = 0; i &lt; 10; i++) + printf(&quot;%d &quot;, arr[i]); + printf(&quot;\n&quot;); + + return 0; +} + +void modify(int *a, int n) +{ + int i; + for (i = 0; i &lt; n; i++) + { + a[i] = a[i] * 3; + } +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc060-c', 'luc060.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc060.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc060.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc060.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc060-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* For the following set of sample data, compute the standard deviation and the mean.\nData: -6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2 +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int data[] = {-6, -12, 8, 13, 11, 6, 7, 2, -6, -9, -10, 11, 10, 9, 2}; + int n = 15, i; + double sum = 0.0, mean, std_dev = 0.0; + + // Calculate Mean + for (i = 0; i &lt; n; i++) + { + sum += data[i]; + } + mean = sum / n; + + // Calculate Standard Deviation + for (i = 0; i &lt; n; i++) + { + std_dev += pow(data[i] - mean, 2); + } + std_dev = sqrt(std_dev / n); + + printf(&quot;Count: %d\n&quot;, n); + printf(&quot;Mean: %.2f\n&quot;, mean); + printf(&quot;Standard Deviation: %.2f\n&quot;, std_dev); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc061-c', 'luc061.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc061.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc061.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc061.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc061-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* The area of a triangle can be computed by the sine law. Given 6 triangular pieces of land (a, b, angle), find their area and determine which is largest. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(g) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + // Data arrays + double a[] = {137.4, 155.2, 149.3, 160.0, 155.6, 149.7}; + double b[] = {80.9, 92.62, 97.93, 100.25, 68.95, 120.0}; + double angle[] = {0.78, 0.89, 1.35, 9.00, 1.25, 1.75}; // Assuming radians based on values &lt; 2.0. 9.00 is treated as literal. + + double area, max_area = 0.0; + int i, max_index = -1; + + printf(&quot;Plot No.\tArea\n&quot;); + printf(&quot;------------------------\n&quot;); + + for (i = 0; i &lt; 6; i++) + { + // Area = 1/2 * a * b * sin(angle) + area = 0.5 * a[i] * b[i] * sin(angle[i]); + + printf(&quot;%d\t\t%.2f\n&quot;, i + 1, area); + + if (area &gt; max_area) + { + max_area = area; + max_index = i + 1; + } + } + + printf(&quot;\nLargest Plot is No. %d with Area: %.2f\n&quot;, max_index, max_area); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc062-c', 'luc062.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc062.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc062.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc062.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc062-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* For the following set of n data points (x, y), write a program to compute the correlation coefficient r. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(h) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + double x[] = {34.22, 39.87, 41.85, 43.23, 40.06, 53.29, 53.29, 54.14, 49.12, 40.71, 55.15}; + double y[] = {102.43, 100.93, 97.43, 97.81, 98.32, 98.32, 100.07, 97.08, 91.59, 94.85, 94.65}; + + int n = 11, i; + double sum_x = 0, sum_y = 0, sum_xy = 0, sum_x2 = 0, sum_y2 = 0; + double numerator, denominator, r; + + for (i = 0; i &lt; n; i++) + { + sum_x += x[i]; + sum_y += y[i]; + sum_xy += x[i] * y[i]; + sum_x2 += x[i] * x[i]; + sum_y2 += y[i] * y[i]; + } + + numerator = (n * sum_xy) - (sum_x * sum_y); + denominator = sqrt((n * sum_x2 - sum_x * sum_x) * (n * sum_y2 - sum_y * sum_y)); + + if (denominator != 0) + r = numerator / denominator; + else + r = 0; // Avoid division by zero + + printf(&quot;Correlation coefficient (r) = %.4f\n&quot;, r); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc063-c', 'luc063.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc063.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc063.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc063.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc063-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* The X and Y coordinates of 10 different points are entered through the keyboard. Write a program to find the distance of last point from the first point (sum of distances between consecutive points). +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(i) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + double x[10], y[10]; + double total_distance = 0.0; + int i; + + printf(&quot;Enter coordinates (x, y) for 10 points:\n&quot;); + for (i = 0; i &lt; 10; i++) + { + printf(&quot;Point %d: &quot;, i + 1); + scanf(&quot;%lf %lf&quot;, &amp;x[i], &amp;y[i]); + } + + // Sum of distances between consecutive points P(i) and P(i+1) + for (i = 0; i &lt; 9; i++) + { + double dx = x[i+1] - x[i]; + double dy = y[i+1] - y[i]; + total_distance += sqrt(dx*dx + dy*dy); + } + + printf(&quot;\nTotal distance from first to last point: %.2f\n&quot;, total_distance); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc064-c', 'luc064.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc064.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc064.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc064.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc064-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Simulate a Dequeue (Double Ended Queue) using an array. Support: retrieve left, retrieve right, insert left, insert right. Use pointers left and right. +*/ + +/* Let Us C, Chap- 13 (Arrays), Qn No.: B(j) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; +#include &lt;stdlib.h&gt; + +#define MAX 10 + +void insert_left(int *, int *, int *, int); +void insert_right(int *, int *, int *, int); +void retrieve_left(int *, int *, int *); +void retrieve_right(int *, int *, int *); +void display(int *, int, int); + +int main() +{ + int dq[MAX]; + int left = -1, right = -1; + int choice, val; + + while (1) + { + printf(&quot;\n--- Dequeue Menu ---\n&quot;); + printf(&quot;1. Insert Left\n2. Insert Right\n&quot;); + printf(&quot;3. Retrieve Left\n4. Retrieve Right\n&quot;); + printf(&quot;5. Display\n6. Exit\n&quot;); + printf(&quot;Enter choice: &quot;); + scanf(&quot;%d&quot;, &amp;choice); + + switch (choice) + { + case 1: + printf(&quot;Enter value: &quot;); + scanf(&quot;%d&quot;, &amp;val); + insert_left(dq, &amp;left, &amp;right, val); + break; + case 2: + printf(&quot;Enter value: &quot;); + scanf(&quot;%d&quot;, &amp;val); + insert_right(dq, &amp;left, &amp;right, val); + break; + case 3: + retrieve_left(dq, &amp;left, &amp;right); + break; + case 4: + retrieve_right(dq, &amp;left, &amp;right); + break; + case 5: + display(dq, left, right); + break; + case 6: + exit(0); + default: + printf(&quot;Invalid choice!\n&quot;); + } + } + return 0; +} + +void insert_left(int *dq, int *left, int *right, int val) +{ + // Check if full + if ((*left == 0 &amp;&amp; *right == MAX - 1) || (*left == *right + 1)) + { + printf(&quot;Overflow! Dequeue is full.\n&quot;); + return; + } + + if (*left == -1) // Initially empty + { + *left = 0; + *right = 0; + } + else if (*left == 0) // Wrap around + *left = MAX - 1; + else + (*left)--; + + dq[*left] = val; + printf(&quot;Inserted %d at Left.\n&quot;, val); +} + +void insert_right(int *dq, int *left, int *right, int val) +{ + if ((*left == 0 &amp;&amp; *right == MAX - 1) || (*left == *right + 1)) + { + printf(&quot;Overflow! Dequeue is full.\n&quot;); + return; + } + + if (*left == -1) // Initially empty + { + *left = 0; + *right = 0; + } + else if (*right == MAX - 1) // Wrap around + *right = 0; + else + (*right)++; + + dq[*right] = val; + printf(&quot;Inserted %d at Right.\n&quot;, val); +} + +void retrieve_left(int *dq, int *left, int *right) +{ + if (*left == -1) + { + printf(&quot;Underflow! Dequeue is empty.\n&quot;); + return; + } + + printf(&quot;Retrieved from Left: %d\n&quot;, dq[*left]); + + if (*left == *right) // Only one element was present + { + *left = -1; + *right = -1; + } + else if (*left == MAX - 1) + *left = 0; + else + (*left)++; +} + +void retrieve_right(int *dq, int *left, int *right) +{ + if (*left == -1) + { + printf(&quot;Underflow! Dequeue is empty.\n&quot;); + return; + } + + printf(&quot;Retrieved from Right: %d\n&quot;, dq[*right]); + + if (*left == *right) // Only one element was present + { + *left = -1; + *right = -1; + } + else if (*right == 0) + *right = MAX - 1; + else + (*right)--; +} + +void display(int *dq, int left, int right) +{ + int i; + if (left == -1) + { + printf(&quot;Dequeue is Empty\n&quot;); + return; + } + + printf(&quot;Elements: &quot;); + i = left; + while (1) + { + printf(&quot;%d &quot;, dq[i]); + if (i == right) + break; + if (i == MAX - 1) + i = 0; + else + i++; + } + printf(&quot;\n&quot;); +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc065-c', 'luc065.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc065.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc065.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc065.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc065-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to find if a square matrix is symmetric. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int mat[10][10], n, i, j; + int is_symmetric = 1; + + printf(&quot;Enter the size of the square matrix (max 10): &quot;); + scanf(&quot;%d&quot;, &amp;n); + + printf(&quot;Enter elements of the %dx%d matrix:\n&quot;, n, n); + for (i = 0; i &lt; n; i++) + { + for (j = 0; j &lt; n; j++) + { + scanf(&quot;%d&quot;, &amp;mat[i][j]); + } + } + + // Check for symmetry: mat[i][j] must equal mat[j][i] + for (i = 0; i &lt; n; i++) + { + for (j = 0; j &lt; n; j++) + { + if (mat[i][j] != mat[j][i]) + { + is_symmetric = 0; + break; + } + } + if (is_symmetric == 0) + break; + } + + if (is_symmetric) + printf(&quot;\nThe matrix is Symmetric.\n&quot;); + else + printf(&quot;\nThe matrix is NOT Symmetric.\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc066-c', 'luc066.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc066.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc066.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc066.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc066-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to add two 6 x 6 matrices. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int mat1[6][6], mat2[6][6], sum[6][6]; + int i, j; + + // Initializing matrices with some values automatically + // to avoid asking user to enter 72 numbers. + printf(&quot;Initializing two 6x6 matrices with sample data...\n&quot;); + + for (i = 0; i &lt; 6; i++) + { + for (j = 0; j &lt; 6; j++) + { + mat1[i][j] = i + j; // Example data + mat2[i][j] = i * j; // Example data + } + } + + // Adding matrices + for (i = 0; i &lt; 6; i++) + { + for (j = 0; j &lt; 6; j++) + { + sum[i][j] = mat1[i][j] + mat2[i][j]; + } + } + + printf(&quot;\nSum of the two 6x6 matrices:\n&quot;); + for (i = 0; i &lt; 6; i++) + { + for (j = 0; j &lt; 6; j++) + { + printf(&quot;%4d &quot;, sum[i][j]); + } + printf(&quot;\n&quot;); + } + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc067-c', 'luc067.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc067.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc067.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc067.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc067-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to multiply any two 3 x 3 matrices. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(g) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + int mat1[3][3], mat2[3][3], res[3][3]; + int i, j, k; + + printf(&quot;Enter elements of first 3x3 matrix:\n&quot;); + for (i = 0; i &lt; 3; i++) + for (j = 0; j &lt; 3; j++) + scanf(&quot;%d&quot;, &amp;mat1[i][j]); + + printf(&quot;Enter elements of second 3x3 matrix:\n&quot;); + for (i = 0; i &lt; 3; i++) + for (j = 0; j &lt; 3; j++) + scanf(&quot;%d&quot;, &amp;mat2[i][j]); + + // Initialize result matrix to 0 + for (i = 0; i &lt; 3; i++) + for (j = 0; j &lt; 3; j++) + res[i][j] = 0; + + // Multiplication Logic + for (i = 0; i &lt; 3; i++) + { + for (j = 0; j &lt; 3; j++) + { + for (k = 0; k &lt; 3; k++) + { + res[i][j] += mat1[i][k] * mat2[k][j]; + } + } + } + + printf(&quot;\nResult of Multiplication:\n&quot;); + for (i = 0; i &lt; 3; i++) + { + for (j = 0; j &lt; 3; j++) + { + printf(&quot;%4d &quot;, res[i][j]); + } + printf(&quot;\n&quot;); + } + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc068-c', 'luc068.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc068.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc068.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc068.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc068-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Given an array p[5], write a function to shift it circularly left by two positions. Call this function for a 4 x 5 matrix and get its rows left shifted. +*/ + +/* Let Us C, Chap- 14 (Multidimensional Arrays), Qn No.: C(h) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; + +void shift_left_two(int *p, int n); +void print_row(int *p, int n); + +int main() +{ + int mat[4][5] = { + {15, 30, 28, 19, 61}, + {1, 2, 3, 4, 5}, + {10, 20, 30, 40, 50}, + {5, 4, 3, 2, 1} + }; + int i; + + printf(&quot;Original Matrix:\n&quot;); + for (i = 0; i &lt; 4; i++) + print_row(mat[i], 5); + + // Apply shift to each row + for (i = 0; i &lt; 4; i++) + { + shift_left_two(mat[i], 5); + } + + printf(&quot;\nMatrix after shifting each row left by 2:\n&quot;); + for (i = 0; i &lt; 4; i++) + print_row(mat[i], 5); + + return 0; +} + +void shift_left_two(int *p, int n) +{ + if (n &lt; 2) return; // Cannot shift if less than 2 elements + + int temp1 = p[0]; + int temp2 = p[1]; + int i; + + // Shift elements left by 2 + for (i = 0; i &lt; n - 2; i++) + { + p[i] = p[i + 2]; + } + + // Place the first two elements at the end + p[n - 2] = temp1; + p[n - 1] = temp2; +} + +void print_row(int *p, int n) +{ + int i; + for (i = 0; i &lt; n; i++) + { + printf(&quot;%d &quot;, p[i]); + } + printf(&quot;\n&quot;); +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc069-c', 'luc069.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc069.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc069.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc069.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc069-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* If the string &quot;Alice in wonder land&quot; is fed to the following scanf() statement, what will be the contents of arrays str1, str2, str3 and str4? +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + char str1[20], str2[20], str3[20], str4[20]; + + printf(&quot;Enter the string &#x27;Alice in wonder land&#x27;: &quot;); + /* scanf stops reading at the first whitespace character for %s */ + scanf(&quot;%s%s%s%s&quot;, str1, str2, str3, str4); + + printf(&quot;\nContents of arrays:\n&quot;); + printf(&quot;str1: %s\n&quot;, str1); + printf(&quot;str2: %s\n&quot;, str2); + printf(&quot;str3: %s\n&quot;, str3); + printf(&quot;str4: %s\n&quot;, str4); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc070-c', 'luc070.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc070.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc070.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc070.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc070-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives a 10-digit ISBN number, computes the checksum (d1 + 2d2 + 3d3 + ... + 10d10), and reports whether the ISBN number is correct (sum divisible by 11). +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + char isbn[15]; + int i, sum = 0, digit; + + printf(&quot;Enter 10-digit ISBN number: &quot;); + scanf(&quot;%s&quot;, isbn); + + /* The formula given is: d1 + 2d2 + 3d3 + ... + 10d10 + where di is the ith digit from the RIGHT. + + If input is &quot;007462542X&quot; (Length 10): + isbn[0] is d10 (Weight 10) + isbn[1] is d9 (Weight 9) + ... + isbn[9] is d1 (Weight 1) + */ + + for (i = 0; i &lt; 10; i++) + { + // Handle &#x27;X&#x27; which represents 10 in ISBN + if (isbn[i] == &#x27;X&#x27; || isbn[i] == &#x27;x&#x27;) + digit = 10; + else + digit = isbn[i] - &#x27;0&#x27;; + + // Weight is (10 - i) + sum += digit * (10 - i); + } + + printf(&quot;Calculated Checksum: %d\n&quot;, sum); + + if (sum % 11 == 0) + printf(&quot;The ISBN number is Correct.\n&quot;); + else + printf(&quot;The ISBN number is Incorrect.\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc071-c', 'luc071.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc071.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc071.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc071.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc071-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives a 16-digit Credit Card number and checks whether it is valid using the Luhn algorithm variant described. +*/ + +/* Let Us C, Chap- 15 (Strings), Qn No.: C(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; + +int main() +{ + char card[20]; + int i, digit, sum = 0; + + printf(&quot;Enter 16-digit Credit Card number: &quot;); + scanf(&quot;%s&quot;, card); + + /* Rule: + 1. Start with rightmost-1 digit (index 14) and multiply every other digit by 2. + (These are indices 0, 2, 4, ..., 14) + 2. Subtract 9 if result &gt;= 10. + 3. Add these results. + 4. Add remaining digits (indices 1, 3, ..., 15). + 5. If total sum is divisible by 10, it is valid. + */ + + for (i = 0; i &lt; 16; i++) + { + digit = card[i] - &#x27;0&#x27;; + + if (i % 2 == 0) // Indices 0, 2, 4... (Every other starting from left, which hits rightmost-1) + { + digit = digit * 2; + if (digit &gt;= 10) + { + digit = digit - 9; + } + } + + // Add to total sum (both modified and unmodified digits) + sum += digit; + } + + printf(&quot;Total Sum: %d\n&quot;, sum); + + if (sum % 10 == 0) + printf(&quot;The Credit Card number is Valid.\n&quot;); + else + printf(&quot;The Credit Card number is Invalid.\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc072-c', 'luc072.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc072.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc072.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc072.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc072-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* How many bytes in memory would be occupied by the following array of pointers to strings? How many bytes would be required to store the same strings in a two-dimensional character array? +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(a) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +int main() +{ + /* Question Analysis: + char *mess[] = {&quot;Hammer and tongs&quot;, &quot;Tooth and nail&quot;, &quot;Spit and polish&quot;, &quot;You and C&quot;}; + + 1. Array of Pointers (*mess[]): + - It stores 4 pointers. + - Size of a pointer is typically 4 bytes (32-bit) or 8 bytes (64-bit). + - Total = 4 * sizeof(char*) + - Plus the strings themselves are stored elsewhere in memory. + + 2. Two-Dimensional Array (mess[][]): + - Must accommodate the longest string (&quot;Hammer and tongs&quot; = 16 chars + null = 17). + - Width would be 17 (or more). + - Size = 4 rows * 17 cols * 1 byte. + */ + + char *mess_ptr[] = { + &quot;Hammer and tongs&quot;, + &quot;Tooth and nail&quot;, + &quot;Spit and polish&quot;, + &quot;You and C&quot; + }; + + // Longest string length + 1 for null terminator + // &quot;Hammer and tongs&quot; is 16 chars long. + char mess_2d[4][17] = { + &quot;Hammer and tongs&quot;, + &quot;Tooth and nail&quot;, + &quot;Spit and polish&quot;, + &quot;You and C&quot; + }; + + printf(&quot;--- Memory Occupation Analysis ---\n\n&quot;); + + printf(&quot;1. Array of Pointers (char *mess[]):\n&quot;); + printf(&quot; Size of array object itself (4 pointers): %zu bytes\n&quot;, sizeof(mess_ptr)); + printf(&quot; (Note: The string literals are stored in read-only memory separately)\n\n&quot;); + + printf(&quot;2. Two-Dimensional Array (char mess[4][17]):\n&quot;); + printf(&quot; Size of 2D array: %zu bytes\n&quot;, sizeof(mess_2d)); + printf(&quot; (Calculation: 4 rows * 17 columns * 1 byte)\n&quot;); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc073-c', 'luc073.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc073.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc073.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc073.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc073-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(b) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +int main() +{ + char str[81], res[81]; + int i, j = 0; + + printf(&quot;Enter a sentence (max 80 chars): &quot;); + gets(str); // Note: gets is deprecated, but used here for simplicity as per classic C texts + + for (i = 0; str[i] != &#x27;\0&#x27;; i++) + { + char ch = tolower(str[i]); + if (ch == &#x27;a&#x27; || ch == &#x27;e&#x27; || ch == &#x27;i&#x27; || ch == &#x27;o&#x27; || ch == &#x27;u&#x27;) + { + // Skip vowel + continue; + } + else + { + res[j] = str[i]; + j++; + } + } + res[j] = &#x27;\0&#x27;; + + printf(&quot;Sentence without vowels: %s\n&quot;, res); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc074-c', 'luc074.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc074.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc074.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc074.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc074-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that will read a line and delete from it all occurrences of the word &#x27;the&#x27;. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(c) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +int main() +{ + char str[100], res[100]; + int i = 0, j = 0; + + printf(&quot;Enter a line of text: &quot;); + gets(str); + + while (str[i] != &#x27;\0&#x27;) + { + /* Check if the current segment matches &quot;the&quot; */ + /* To be a word &#x27;the&#x27;, it should effectively be surrounded by non-alphabets or start/end of string. + For simplicity in this context, we check if str[i..] starts with &quot;the&quot; */ + + if ((str[i] == &#x27;t&#x27; || str[i] == &#x27;T&#x27;) &amp;&amp; + (str[i+1] == &#x27;h&#x27; || str[i+1] == &#x27;H&#x27;) &amp;&amp; + (str[i+2] == &#x27;e&#x27; || str[i+2] == &#x27;E&#x27;) &amp;&amp; + (str[i+3] == &#x27; &#x27; || str[i+3] == &#x27;\0&#x27;)) + { + // Found &quot;the&quot; followed by space or null. Skip &quot;the&quot;. + i += 3; + + // If it was followed by a space, we might want to skip the space too + // to avoid double spaces, but the problem says delete &#x27;the&#x27;. + // Let&#x27;s just skip the word. + } + else + { + res[j] = str[i]; + j++; + i++; + } + } + res[j] = &#x27;\0&#x27;; + + printf(&quot;Text after removing &#x27;the&#x27;: %s\n&quot;, res); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc075-c', 'luc075.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc075.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc075.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc075.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc075-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that stores a set of names of individuals and abbreviates the first and middle name to their first letter. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(d) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +int main() +{ + char names[5][50]; + char abbr[50]; + int i, j, k, len, space_count; + + printf(&quot;Enter 5 full names (First Middle Last):\n&quot;); + for (i = 0; i &lt; 5; i++) + { + printf(&quot;Name %d: &quot;, i + 1); + gets(names[i]); + } + + printf(&quot;\nAbbreviated Names:\n&quot;); + for (i = 0; i &lt; 5; i++) + { + len = strlen(names[i]); + space_count = 0; + k = 0; + + // Add first initial + abbr[k++] = names[i][0]; + abbr[k++] = &#x27;.&#x27;; + abbr[k++] = &#x27; &#x27;; + + // Find spaces to get subsequent parts + for (j = 0; j &lt; len; j++) + { + if (names[i][j] == &#x27; &#x27;) + { + space_count++; + if (space_count == 1) // Found start of Middle name + { + abbr[k++] = names[i][j+1]; + abbr[k++] = &#x27;.&#x27;; + abbr[k++] = &#x27; &#x27;; + } + else if (space_count == 2) // Found start of Last name + { + // Copy the rest of the last name + int m = j + 1; + while (names[i][m] != &#x27;\0&#x27;) + { + abbr[k++] = names[i][m++]; + } + // Stop searching + break; + } + } + } + abbr[k] = &#x27;\0&#x27;; + printf(&quot;%s\n&quot;, abbr); + } + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc076-c', 'luc076.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc076.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc076.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc076.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc076-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program to count the number of occurrences of any two vowels in succession in a line of text. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(e) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +int is_vowel(char c) +{ + c = tolower(c); + return (c == &#x27;a&#x27; || c == &#x27;e&#x27; || c == &#x27;i&#x27; || c == &#x27;o&#x27; || c == &#x27;u&#x27;); +} + +int main() +{ + char str[100]; + int i, count = 0; + + printf(&quot;Enter a line of text: &quot;); + gets(str); + + printf(&quot;Occurrences found:\n&quot;); + for (i = 0; str[i] != &#x27;\0&#x27;; i++) + { + if (is_vowel(str[i]) &amp;&amp; is_vowel(str[i+1])) + { + printf(&quot;&#x27;%c%c&#x27; &quot;, str[i], str[i+1]); + count++; + } + } + + printf(&quot;\n\nTotal number of successive vowels: %d\n&quot;, count); + + return 0; +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-luc077-c', 'luc077.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc077.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">luc077.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/luc077.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-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-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 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.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-letusc-luc077-c" style="display:none;">/* + * Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; + * Date : 08 Feb 2026 + * Repo : https://github.com/notamitgamer/bsc + * License : MIT License (See the LICENSE file for details) + * Copyright (c) 2026 Amit Dutta + */ + +/* Write a program that receives an integer (less than or equal to nine digits in length) and prints out the number in words. +*/ + +/* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(f) */ + +/* This file is auto-generated by a bot. */ +/* This code is not compiled; it is for reference only. */ + + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; +#include &lt;stdlib.h&gt; +#include &lt;ctype.h&gt; + +void convert(long, char *); + +char *one[] = { + &quot;&quot;, &quot;One &quot;, &quot;Two &quot;, &quot;Three &quot;, &quot;Four &quot;, &quot;Five &quot;, &quot;Six &quot;, &quot;Seven &quot;, &quot;Eight &quot;, &quot;Nine &quot;, + &quot;Ten &quot;, &quot;Eleven &quot;, &quot;Twelve &quot;, &quot;Thirteen &quot;, &quot;Fourteen &quot;, &quot;Fifteen &quot;, &quot;Sixteen &quot;, + &quot;Seventeen &quot;, &quot;Eighteen &quot;, &quot;Nineteen &quot; +}; + +char *ten[] = { + &quot;&quot;, &quot;&quot;, &quot;Twenty &quot;, &quot;Thirty &quot;, &quot;Forty &quot;, &quot;Fifty &quot;, &quot;Sixty &quot;, &quot;Seventy &quot;, &quot;Eighty &quot;, &quot;Ninety &quot; +}; + +int main() +{ + long num; + + printf(&quot;Enter a number (max 9 digits): &quot;); + scanf(&quot;%ld&quot;, &amp;num); + + if (num &lt;= 0) + { + printf(&quot;Zero\n&quot;); + } + else + { + printf(&quot;In words: &quot;); + // Indian System: Crore, Lakh, Thousand, Hundred + convert((num / 10000000), &quot;Crore &quot;); + convert(((num / 100000) % 100), &quot;Lakh &quot;); + convert(((num / 1000) % 100), &quot;Thousand &quot;); + convert(((num / 100) % 10), &quot;Hundred &quot;); + convert((num % 100), &quot;&quot;); + printf(&quot;\n&quot;); + } + + return 0; +} + +void convert(long n, char *suffix) +{ + if (n &gt; 19) + { + printf(&quot;%s%s&quot;, ten[n / 10], one[n % 10]); + } + else + { + printf(&quot;%s&quot;, one[n]); + } + + if (n &gt; 0) + { + printf(&quot;%s&quot;, suffix); + } +}</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-letusc-lucproblem001-c', 'lucproblem001.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/letusc/lucproblem001.c')"> <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror