bsc

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

commit c5739745e301f637f969542ff7a769bd345daf64
parent 2f6e9729b2252990d636420bd3339a6ea4c44819
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Wed, 10 Dec 2025 21:10:44 +0530

[2025-12-10] .\assignment-secondary\..\ : Added 8 assignment files for assignment-secondary folder.

Diffstat:
Aassignment-secondary/assignment-s-01.c | 40++++++++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-02.c | 31+++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-03.c | 34++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-04.c | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-05.c | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-06.c | 37+++++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-07.c | 41+++++++++++++++++++++++++++++++++++++++++
Aassignment-secondary/assignment-s-08.c | 40++++++++++++++++++++++++++++++++++++++++
Mdocs/index.html | 692+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
9 files changed, 752 insertions(+), 276 deletions(-)

diff --git a/assignment-secondary/assignment-s-01.c b/assignment-secondary/assignment-s-01.c @@ -0,0 +1,39 @@ +/* Write a program to compute the sum and product of digits of an integer using user +defined functions. */ + +#include <stdio.h> + +int sum_of_digits(int); +int product_of_digits(int); + +int main() +{ + int num; + printf("Enter the number: "); + scanf("%d", &num); + printf("\nSum of digits of %d = %d", num, sum_of_digits(num)); + printf("\nProduct of digits of %d = %d", num, product_of_digits(num)); + return 0; +} + +int sum_of_digits(int num) +{ + int sum = 0; + while (num > 0) + { + sum += num % 10; + num /= 10; + } + return sum; +} + +int product_of_digits(int num) +{ + int product = 1; + while (num > 0) + { + product *= num % 10; + num /= 10; + } + return product; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-02.c b/assignment-secondary/assignment-s-02.c @@ -0,0 +1,30 @@ +/* Write a program to reverse a non-negative integer using a function. */ + +#include <stdio.h> + +int reverse(int); + +int main() +{ + int num; + printf("Enter a non-negetive integer: "); + scanf("%d", &num); + if (num < 0) + { + printf("\nOnly non-negetive integers are allowed."); + return 1; + } + printf("\nReverse of the integer %d = %d", num, reverse(num)); + return 0; +} + +int reverse(int num) +{ + int rev = 0; + while (num > 0) + { + rev = (rev * 10) + (num % 10); + num /= 10; + } + return rev; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-03.c b/assignment-secondary/assignment-s-03.c @@ -0,0 +1,33 @@ +/* Write a program to compute the sum of the first n terms of the series using a function: +S=1−2+3−4+5−6+… */ + +#include <stdio.h> + +int sum_of_series(int); + +int main() +{ + int n; + printf("Enter the n: "); + scanf("%d", &n); + printf("\nSum of the first %d terms of the series = %d", n, sum_of_series(n)); + return 0; +} + +int sum_of_series(int n) +{ + int sum = 0; + int i; + for (i = 1; i <= n; i++) + { + if (i % 2 == 0) + { + sum -= i; + } + else + { + sum += i; + } + } + return sum; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-04.c b/assignment-secondary/assignment-s-04.c @@ -0,0 +1,52 @@ +/* Write a function to check whether a number is prime or not. Use the same function to +generate all prime numbers less than 100. */ + +#include <stdio.h> +#include <math.h> + +int isPrime(int); + +int main() +{ + int n, i; + printf("Enter the number: "); + scanf("%d", &n); + if (isPrime(n)) + { + printf("\nInput %d is a Prime Number.", n); + } + else + { + printf("\nInput %d is not a Prime Number.", n); + } + printf("\nPrime Numbers less than 100:"); + for (i = 1; i < 100; i++) + { + if (isPrime(i)) + { + printf(" %d", i); + } + } + return 0; +} + +int isPrime(int n) +{ + if (n <= 1) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + + int temp = (int)sqrt(n); + int i; + for (i = 3; i <= temp; i += 2) + { + if (n % i == 0) + { + return 0; + } + } + return 1; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-05.c b/assignment-secondary/assignment-s-05.c @@ -0,0 +1,59 @@ +/* Write a function to check whether a given string is a palindrome. Use this function to +determine whether an entered string is Palindrome. */ + +#include <stdio.h> +#include <string.h> + +int isPalindrome(char[]); + +int main() +{ + char input[100]; + int len; + + printf("Enter the string (Max: 100 Character): "); + fgets(input, sizeof(input), stdin); + len = strlen(input); + + if (len > 0 && input[len - 1] == '\n') + { + input[len - 1] = '\0'; + } + + if (isPalindrome(input)) + { + printf("\nInput string \"%s\" is Palindrome.", input); + } + else + { + printf("\nInput string \"%s\" is not Palindrome", input); + } + + return 0; +} + +int isPalindrome(char str[]) +{ + char *start = str; + char *end; + int len = strlen(str); + + if (len == 0) + { + return 1; + } + + end = str + (len - 1); + + while (start < end) + { + if (*start != *end) + { + return 0; + } + start++; + end--; + } + + return 1; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-06.c b/assignment-secondary/assignment-s-06.c @@ -0,0 +1,36 @@ +/* Write a program using a function to compute and display all factors of a given number. */ + +#include <stdio.h> +#include <stdlib.h> + +void display_factors(int); + +int main() +{ + int num, i; + printf("Please enter the number to get the factors from it : "); + scanf("%d", &num); + display_factors(num); + return 0; +} + +void display_factors(int num) { + int temp = abs(num); + int i; + + if (temp == 0) + { + printf("\n0 has infinitely many factors (all integers)."); + exit(1); + } + + printf("\nThe factors of ' %d ' is :- ", num); + printf("\nPositive : "); + for (i = 1; i <= temp; i++) + if (temp % i == 0) + printf(" %d", i); + printf("\nNegative : "); + for (i = 1; i <= temp; i++) + if (temp % i == 0) + printf(" %d", -i); +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-07.c b/assignment-secondary/assignment-s-07.c @@ -0,0 +1,40 @@ +/* Write a program to swap two numbers using a macro (#define). */ + +// IMPOSSIBLE +/* It is impossible to swap two literal numbers defined using the +preprocessor directive #define. This is because #define performs simple +text substitution and does not create variables in memory that can be +manipulated or pointed to. */ + +// Using a Function-Like Macro + +#include <stdio.h> + +// Define the SWAP macro. +// The do-while(0) block is a common trick to ensure the macro behaves +// like a single statement, regardless of where it is used (e.g., inside an 'if' statement). +#define SWAP(a, b, data_type) \ + do { \ + data_type temp = a; \ + a = b; \ + b = temp; \ + } while(0) + +int main() { + int num1 = 15; + int num2 = 42; + + printf("--- Before Swap ---\n"); + printf("Number 1 (num1): %d\n", num1); + printf("Number 2 (num2): %d\n", num2); + + // Call the macro, passing the variables and their type + // The preprocessor replaces this line with the block of code defined above. + SWAP(num1, num2, int); + + printf("\n--- After Swap (using macro) ---\n"); + printf("Number 1 (num1): %d\n", num1); + printf("Number 2 (num2): %d\n", num2); + + return 0; +}+ \ No newline at end of file diff --git a/assignment-secondary/assignment-s-08.c b/assignment-secondary/assignment-s-08.c @@ -0,0 +1,39 @@ +/* Write a program that counts the number of occurrences of each alphabet (A-Z, a-z) in +the text entered using Command-Line Arguments. */ + +#include <stdio.h> +#include <string.h> + +int main(int argc, char *argv[]) +{ + int target[2], i, j, count[2], len; + for (target[0] = 'A', target[1] = 'a'; target[0] <= 'Z', target[1] <= 'z'; target[0]++, target[1]++) + { + count[0] = 0; + count[1] = 0; + for (i = 1; i < argc; i++) + { + len = strlen(argv[i]); + for (j = 0; j < len; j++) + { + if (argv[i][j] == target[0]) + { + count[0]++; + } + if (argv[i][j] == target[1]) + { + count[1]++; + } + } + } + if (count[0]) + { + printf("\n\"%c\" found %d times.", target[0], count[0]); + } + if (count[1]) + { + printf("\n\"%c\" found %d times.", target[1], count[1]); + } + } + return 0; +}+ \ No newline at end of file diff --git a/docs/index.html b/docs/index.html @@ -208,36 +208,36 @@ <ul class="space-y-3"> <li class="border rounded-lg overflow-hidden"> - <div class="folder-header bg-gray-100 p-4 cursor-pointer hover:bg-blue-100 transition-colors duration-200" onclick="toggleFolder('assignment')"> + <div class="folder-header bg-gray-100 p-4 cursor-pointer hover:bg-blue-100 transition-colors duration-200" onclick="toggleFolder('assignment-primary')"> <div class="flex items-center justify-between"> <div class="flex items-center"> <svg class="w-6 h-6 text-blue-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> - <span class="font-medium text-gray-800">assignment</span> + <span class="font-medium text-gray-800">assignment-primary</span> <span class="ml-2 text-sm text-gray-500">(15 files)</span> </div> <div class="flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/tree/main/assignment" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub"> + <a href="https://github.com/notamitgamer/bsc/tree/main/assignment-primary" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <div class="chevron" id="chevron-assignment"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div> + <div class="chevron" id="chevron-assignment-primary"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div> </div> </div> </div> - <div class="folder-content hidden bg-white" id="folder-assignment"> + <div class="folder-content hidden bg-white" id="folder-assignment-primary"> <ul class="divide-y divide-gray-200"> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment01.c</span> + <span class="text-gray-700">assignment-p-01.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment01.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-01.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment01_c', 'assignment01.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-01_c', 'assignment-p-01.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment01_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment01.c"> + <div id="code-assignment-primary-assignment-p-01_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-01.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named isPrime with the signature int isPrime(int num); The function should take an integer as a parameter and return 1 if the number is prime and 0 otherwise. */ @@ -292,15 +292,15 @@ int isPrime(int n) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment02.c</span> + <span class="text-gray-700">assignment-p-02.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment02.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-02.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment02_c', 'assignment02.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-02_c', 'assignment-p-02.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment02_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment02.c"> + <div id="code-assignment-primary-assignment-p-02_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-02.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named isArmstrong with the signature int isArmstrong(int num);. An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, @@ -367,15 +367,15 @@ int isArmstrong(int n) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment03.c</span> + <span class="text-gray-700">assignment-p-03.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment03.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-03.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment03_c', 'assignment03.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-03_c', 'assignment-p-03.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment03_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment03.c"> + <div id="code-assignment-primary-assignment-p-03_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-03.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named isPerfect with the signature int isPerfect(int num);. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 28 is a perfect number because the sum @@ -423,15 +423,15 @@ int isPerfect(int n) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment04.c</span> + <span class="text-gray-700">assignment-p-04.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment04.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-04.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment04_c', 'assignment04.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-04_c', 'assignment-p-04.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment04_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment04.c"> + <div id="code-assignment-primary-assignment-p-04_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-04.c"> <pre><code class="language-c">/* Write a C program that takes an integer input representing a month (1 to 12) and a year. Use a switch statement to display the number of days in that month, considering leap years. */ @@ -485,15 +485,15 @@ int main() <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment05.c</span> + <span class="text-gray-700">assignment-p-05.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment05.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-05.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment05_c', 'assignment05.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-05_c', 'assignment-p-05.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment05_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment05.c"> + <div id="code-assignment-primary-assignment-p-05_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-05.c"> <pre><code class="language-c">/* Write a C program that defines an array of integers, and includes a user-defined function named reverseArray with the signature void reverseArray(int arr[], int size);. The function should reverse the elements of the array. */ @@ -550,15 +550,15 @@ void reverseArray(int arr[], int size) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment06.c</span> + <span class="text-gray-700">assignment-p-06.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment06.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-06.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment06_c', 'assignment06.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-06_c', 'assignment-p-06.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment06_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment06.c"> + <div id="code-assignment-primary-assignment-p-06_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-06.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named findLargest with the signature int findLargest(int arr[], int size);. The function should take an array of integers and its size, and return the largest element in the array. */ @@ -607,15 +607,15 @@ int findLargest(int arr[], int size) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment07.c</span> + <span class="text-gray-700">assignment-p-07.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment07.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-07.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment07_c', 'assignment07.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-07_c', 'assignment-p-07.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment07_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment07.c"> + <div id="code-assignment-primary-assignment-p-07_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-07.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named binarySearch with the signature int binarySearch(int arr[], int size, int target);. The function should perform a binary search on a sorted array of integers and return the index of the target element if @@ -729,15 +729,15 @@ int binarySearch(int arr[], int size, int target) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment08.c</span> + <span class="text-gray-700">assignment-p-08.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment08.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-08.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment08_c', 'assignment08.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-08_c', 'assignment-p-08.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment08_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment08.c"> + <div id="code-assignment-primary-assignment-p-08_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-08.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named countSetBits with the signature int countSetBits(int num);. The function should count and return the number of set bits (1s) in the binary representation of the given number. */ @@ -793,15 +793,15 @@ int countSetBits(int num) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment09.c</span> + <span class="text-gray-700">assignment-p-09.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment09.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-09.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment09_c', 'assignment09.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-09_c', 'assignment-p-09.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment09_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment09.c"> + <div id="code-assignment-primary-assignment-p-09_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-09.c"> <pre><code class="language-c">/* Write a C program that includes a user-defined function named setBit with the signature int setBit(int num, int position);. The function should set the bit at the specified position (0-indexed) to 1 and return the modified number. */ @@ -832,15 +832,15 @@ int setBit(int num, int position) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment10.c</span> + <span class="text-gray-700">assignment-p-10.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment10.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-10.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment10_c', 'assignment10.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-10_c', 'assignment-p-10.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment10_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment10.c"> + <div id="code-assignment-primary-assignment-p-10_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-10.c"> <pre><code class="language-c">/* Write a C program that defines a structure Rectangle with attributes length and width. Include a user-defined function named calculateArea with the signature float calculateArea(struct Rectangle r);. The function should calculate and return the area of @@ -876,15 +876,15 @@ float calculateArea(struct Rectangle r) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment11.c</span> + <span class="text-gray-700">assignment-p-11.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment11.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-11.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment11_c', 'assignment11.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-11_c', 'assignment-p-11.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment11_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment11.c"> + <div id="code-assignment-primary-assignment-p-11_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-11.c"> <pre><code class="language-c">/* Write a C program that defines a structure Student containing the attributes rollNumber, name, and marks. Include a user-defined function named displayStudent with the signature void displayStudent(struct Student s);. The function should display the details @@ -950,15 +950,15 @@ void displayStudent(struct Student std) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment12.c</span> + <span class="text-gray-700">assignment-p-12.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment12.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-12.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment12_c', 'assignment12.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-12_c', 'assignment-p-12.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment12_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment12.c"> + <div id="code-assignment-primary-assignment-p-12_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-12.c"> <pre><code class="language-c">/* Write a C program that takes multiple integers as command-line arguments and finds the maximum and minimum value among them. */ @@ -1011,15 +1011,15 @@ int main(int argc, char *argv[]) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment13.c</span> + <span class="text-gray-700">assignment-p-13.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment13.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-13.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment13_c', 'assignment13.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-13_c', 'assignment-p-13.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment13_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment13.c"> + <div id="code-assignment-primary-assignment-p-13_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-13.c"> <pre><code class="language-c">/* Write a C program that accepts a string as a command line argument and includes a user- defined function named isPalindrome with the signature int isPalindrome(char str[]);. The function should check if the given string is a palindrome and return 1 if it is, and 0 @@ -1092,15 +1092,15 @@ int isPalindrome(char str[]) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment14.c</span> + <span class="text-gray-700">assignment-p-14.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment14.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-14.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment14_c', 'assignment14.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-14_c', 'assignment-p-14.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment14_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment14.c"> + <div id="code-assignment-primary-assignment-p-14_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-14.c"> <pre><code class="language-c">/* Write a C program that opens its own source code file, reads its contents, and then prints the contents to the console. */ @@ -1164,15 +1164,15 @@ int main(int argc, char *argv[]) <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">assignment15.c</span> + <span class="text-gray-700">assignment-p-15.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment15.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-15.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-assignment-assignment15_c', 'assignment15.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-primary-assignment-p-15_c', 'assignment-p-15.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-assignment-assignment15_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment/assignment15.c"> + <div id="code-assignment-primary-assignment-p-15_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-primary/assignment-p-15.c"> <pre><code class="language-c">/* Write a C program that reads a sequence of integers from a file named &#x27;input.txt&#x27;. This program should segregate the odd numbers from the even numbers and store the odd numbers in a new file named &#x27;ODDFile.txt&#x27; while storing the even numbers in another file @@ -1241,329 +1241,469 @@ int main() </li> <li class="border rounded-lg overflow-hidden"> - <div class="folder-header bg-gray-100 p-4 cursor-pointer hover:bg-blue-100 transition-colors duration-200" onclick="toggleFolder('c')"> + <div class="folder-header bg-gray-100 p-4 cursor-pointer hover:bg-blue-100 transition-colors duration-200" onclick="toggleFolder('assignment-secondary')"> <div class="flex items-center justify-between"> <div class="flex items-center"> <svg class="w-6 h-6 text-blue-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg> - <span class="font-medium text-gray-800">c</span> - <span class="ml-2 text-sm text-gray-500">(7 files)</span> + <span class="font-medium text-gray-800">assignment-secondary</span> + <span class="ml-2 text-sm text-gray-500">(8 files)</span> </div> <div class="flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/tree/main/c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub"> + <a href="https://github.com/notamitgamer/bsc/tree/main/assignment-secondary" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" onclick="event.stopPropagation()" title="View folder on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <div class="chevron" id="chevron-c"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div> + <div class="chevron" id="chevron-assignment-secondary"><svg class="w-5 h-5 text-gray-500 transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></div> </div> </div> </div> - <div class="folder-content hidden bg-white" id="folder-c"> + <div class="folder-content hidden bg-white" id="folder-assignment-secondary"> <ul class="divide-y divide-gray-200"> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">1.c</span> + <span class="text-gray-700">assignment-s-01.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/1.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-01.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-1_c', '1.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-01_c', 'assignment-s-01.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-1_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/1.c"> - <pre><code class="language-c">// Write a program (WAP) to print the sum and product of digits of an integer. -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-01_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-01.c"> + <pre><code class="language-c">/* Write a program to compute the sum and product of digits of an integer using user +defined functions. */ -#include&lt;stdio.h&gt; +#include &lt;stdio.h&gt; -int main() { - int inp, result_sum = 0, result_product = 1, temp; - printf(&quot;Please enter the number : &quot;); - scanf(&quot;%d&quot;,&amp;inp); - printf(&quot;\n&quot;); - - if (inp &lt; 0) { - printf(&quot;\nPlease enter a valid non negetive integer.&quot;); - return 1; - } - - temp = inp; - while (temp != 0 ) { - result_sum = result_sum + (temp % 10); - result_product = result_product * (temp % 10); - temp = temp / 10; - } - - printf(&quot;\nSum of the digits of the input number &#x27;%d&#x27; is : %d&quot; - &quot;\nProduct of the digits of the input number &#x27;%d&#x27; is : %d&quot;, - inp, result_sum, inp, result_product); - return 0; +int sum_of_digits(int); +int product_of_digits(int); + +int main() +{ + int num; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;num); + printf(&quot;\nSum of digits of %d = %d&quot;, num, sum_of_digits(num)); + printf(&quot;\nProduct of digits of %d = %d&quot;, num, product_of_digits(num)); + return 0; } -</code></pre> +int sum_of_digits(int num) +{ + int sum = 0; + while (num &gt; 0) + { + sum += num % 10; + num /= 10; + } + return sum; +} + +int product_of_digits(int num) +{ + int product = 1; + while (num &gt; 0) + { + product *= num % 10; + num /= 10; + } + return product; +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">2.c</span> + <span class="text-gray-700">assignment-s-02.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/2.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-02.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-2_c', '2.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-02_c', 'assignment-s-02.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-2_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/2.c"> - <pre><code class="language-c">//WAP to reverse a non-negative integer. -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-02_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-02.c"> + <pre><code class="language-c">/* Write a program to reverse a non-negative integer using a function. */ -#include&lt;stdio.h&gt; +#include &lt;stdio.h&gt; -int main() { - int inp, result = 0, temp; - printf(&quot;PLease enter the number you want to reverse : &quot;); - scanf(&quot;%d&quot;,&amp;inp); - printf(&quot;\n&quot;); - - if (inp &lt; 0) { - printf(&quot;\nPlease enter a non negetive integer.&quot;); - return 1; - } - - temp = inp; - while ( temp != 0) { - result = (result * 10) + (temp % 10); - temp = temp / 10; - } - - printf(&quot;\nReverse of the input &#x27;%d&#x27; is : %d&quot;, inp, result); - return 0; +int reverse(int); + +int main() +{ + int num; + printf(&quot;Enter a non-negetive integer: &quot;); + scanf(&quot;%d&quot;, &amp;num); + if (num &lt; 0) + { + printf(&quot;\nOnly non-negetive integers are allowed.&quot;); + return 1; + } + printf(&quot;\nReverse of the integer %d = %d&quot;, num, reverse(num)); + return 0; } -</code></pre> +int reverse(int num) +{ + int rev = 0; + while (num &gt; 0) + { + rev = (rev * 10) + (num % 10); + num /= 10; + } + return rev; +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">3.c</span> + <span class="text-gray-700">assignment-s-03.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/3.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-03.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-3_c', '3.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-03_c', 'assignment-s-03.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-3_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/3.c"> - <pre><code class="language-c">// WAP to compute the sum of the first n terms of the following series S =1+1/2+1/3+1/4+...... -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-03_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-03.c"> + <pre><code class="language-c">/* Write a program to compute the sum of the first n terms of the series using a function: +S=1−2+3−4+5−6+… */ -#include&lt;stdio.h&gt; +#include &lt;stdio.h&gt; -int main() { - int n, i; - float result = 0; - printf(&quot;Please enter the value for &#x27;n&#x27; : &quot;); - scanf(&quot;%d&quot;, &amp;n); - printf(&quot;\n&quot;); - - if (n &lt;= 0) { - printf(&quot;\nPlease enter a positve number greater than ZERO.&quot;); - return 1; - } - - for (i = 1; i &lt;= n; i++) { - result = result + (1.0 / i); - } - - printf(&quot;\nSum of the first %d terms of the following series S =1+1/2+1/3+1/4+...... is : %f&quot;,n,result); - return 0; +int sum_of_series(int); + +int main() +{ + int n; + printf(&quot;Enter the n: &quot;); + scanf(&quot;%d&quot;, &amp;n); + printf(&quot;\nSum of the first %d terms of the series = %d&quot;, n, sum_of_series(n)); + return 0; } -</code></pre> + +int sum_of_series(int n) +{ + int sum = 0; + int i; + for (i = 1; i &lt;= n; i++) + { + if (i % 2 == 0) + { + sum -= i; + } + else + { + sum += i; + } + } + return sum; +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">4.c</span> + <span class="text-gray-700">assignment-s-04.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/4.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-04.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-4_c', '4.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-04_c', 'assignment-s-04.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-4_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/4.c"> - <pre><code class="language-c">//WAP to compute the sum of the first n terms of the following series,S =1-2+3-4+5...... -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-04_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-04.c"> + <pre><code class="language-c">/* Write a function to check whether a number is prime or not. Use the same function to +generate all prime numbers less than 100. */ -#include&lt;stdio.h&gt; +#include &lt;stdio.h&gt; +#include &lt;math.h&gt; -int main() { - int n, result = 0, temp, i; - printf(&quot;Please enter the value for &#x27;n&#x27; for this series &#x27;s = 1-2+3-4+5-....&#x27;: &quot;); - scanf(&quot;%d&quot;,&amp;n); - printf(&quot;\n&quot;); - - if (n &lt;= 0) { - printf(&quot;\nPlease enter a positive integer.&quot;); - return 1; - } - - for (i = 1; i&lt;= n; i++) { - if (i % 2 == 0) { - result = result - i; - } - else { - result = result + i; - } - } - - printf(&quot;\nAns : %d&quot;, result); +int isPrime(int); + +int main() +{ + int n, i; + printf(&quot;Enter the number: &quot;); + scanf(&quot;%d&quot;, &amp;n); + if (isPrime(n)) + { + printf(&quot;\nInput %d is a Prime Number.&quot;, n); + } + else + { + printf(&quot;\nInput %d is not a Prime Number.&quot;, n); + } + printf(&quot;\nPrime Numbers less than 100:&quot;); + for (i = 1; i &lt; 100; i++) + { + if (isPrime(i)) + { + printf(&quot; %d&quot;, i); + } + } + return 0; } -</code></pre> + +int isPrime(int n) +{ + if (n &lt;= 1) + return 0; + if (n == 2) + return 1; + if (n % 2 == 0) + return 0; + + int temp = (int)sqrt(n); + int i; + for (i = 3; i &lt;= temp; i += 2) + { + if (n % i == 0) + { + return 0; + } + } + return 1; +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">5.c</span> + <span class="text-gray-700">assignment-s-05.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/5.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-05.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-5_c', '5.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-05_c', 'assignment-s-05.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-5_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/5.c"> - <pre><code class="language-c">/*Write a function to find whether a given no. is prime or not. -Use the same to generate the prime numbers less than 100.*/ -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-05_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-05.c"> + <pre><code class="language-c">/* Write a function to check whether a given string is a palindrome. Use this function to +determine whether an entered string is Palindrome. */ -#include&lt;stdio.h&gt; +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; -int isPrime(int inp) { - int i, is_prime = 1; - - if (inp &lt; 2) is_prime = 0; - - for (i = 2; i &lt;= inp / 2; i++) if (inp % i == 0) { - is_prime = 0; - break; - } - - return is_prime; -} +int isPalindrome(char[]); +int main() +{ + char input[100]; + int len; -int main() { - int inp, i; - printf(&quot;Enter the number you want to check : &quot;); - scanf(&quot;%d&quot;,&amp;inp); - printf(&quot;\n&quot;); - - if (isPrime(inp)) printf(&quot;\nGiven input &#x27;%d&#x27; is a Prime Number.&quot;,inp); - else printf(&quot;\nGiven input &#x27;%d&#x27; is not a Prime Number.&quot;,inp); - - printf (&quot;\nSeries of prime number upto 100 : &quot;); - for (i = 2; i &lt; 100; i++) if (isPrime(i)) printf(&quot; %d&quot;,i); - - return 0; + printf(&quot;Enter the string (Max: 100 Character): &quot;); + fgets(input, sizeof(input), stdin); + len = strlen(input); + + if (len &gt; 0 &amp;&amp; input[len - 1] == &#x27;\n&#x27;) + { + input[len - 1] = &#x27;\0&#x27;; + } + + if (isPalindrome(input)) + { + printf(&quot;\nInput string \&quot;%s\&quot; is Palindrome.&quot;, input); + } + else + { + printf(&quot;\nInput string \&quot;%s\&quot; is not Palindrome&quot;, input); + } + + return 0; } -</code></pre> + +int isPalindrome(char str[]) +{ + char *start = str; + char *end; + int len = strlen(str); + + if (len == 0) + { + return 1; + } + + end = str + (len - 1); + + while (start &lt; end) + { + if (*start != *end) + { + return 0; + } + start++; + end--; + } + + return 1; +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">6.c</span> + <span class="text-gray-700">assignment-s-06.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/6.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-06.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-6_c', '6.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-06_c', 'assignment-s-06.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-6_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/6.c"> - <pre><code class="language-c">/*Write a function that checks whether a given string is Palindrome or not. -Use this function to find whether the string entered by the user is Palindrome or not.*/ -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-06_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-06.c"> + <pre><code class="language-c">/* Write a program using a function to compute and display all factors of a given number. */ -#include&lt;stdio.h&gt; -#include&lt;string.h&gt; - -int isPalindrome(char inp[]) { - int len = strlen(inp); - int i = 0; //starting point - int j = len - 1; //end point - - while (i &lt; j) { - if (inp[i] != inp[j]) { - return 0; - } - i++; - j--; - } +#include &lt;stdio.h&gt; +#include &lt;stdlib.h&gt; - return 1; -} +void display_factors(int); -int main() { - char inp[20]; - printf(&quot;Enter the number : &quot;); - scanf(&quot;%s&quot;,inp); - if (isPalindrome(inp)) printf(&quot;\n\nInput &#x27;%s&#x27; is a Palindrome number.&quot;, inp); - else printf(&quot;\n\nInput &#x27;%s&#x27; is not a Palindrome number.&quot;, inp); - return 0; +int main() +{ + int num, i; + printf(&quot;Please enter the number to get the factors from it : &quot;); + scanf(&quot;%d&quot;, &amp;num); + display_factors(num); + return 0; } -</code></pre> + +void display_factors(int num) { + int temp = abs(num); + int i; + + if (temp == 0) + { + printf(&quot;\n0 has infinitely many factors (all integers).&quot;); + exit(1); + } + + printf(&quot;\nThe factors of &#x27; %d &#x27; is :- &quot;, num); + printf(&quot;\nPositive : &quot;); + for (i = 1; i &lt;= temp; i++) + if (temp % i == 0) + printf(&quot; %d&quot;, i); + printf(&quot;\nNegative : &quot;); + for (i = 1; i &lt;= temp; i++) + if (temp % i == 0) + printf(&quot; %d&quot;, -i); +}</code></pre> </div> </li> <li> <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> - <span class="text-gray-700">7.c</span> + <span class="text-gray-700">assignment-s-07.c</span> <div class="ml-auto flex items-center space-x-4"> - <a href="https://github.com/notamitgamer/bsc/blob/main/c/7.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-07.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> </a> - <button onclick="showCode('code-c-7_c', '7.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + <button onclick="showCode('code-assignment-secondary-assignment-s-07_c', 'assignment-s-07.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> </div> </div> - <div id="code-c-7_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/c/7.c"> - <pre><code class="language-c">// WAP to compute the factors of a given number -// Author - Amit Dutta, Date - 13th SEP, 2025 + <div id="code-assignment-secondary-assignment-s-07_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-07.c"> + <pre><code class="language-c">/* Write a program to swap two numbers using a macro (#define). */ -#include&lt;stdio.h&gt; -#include&lt;stdlib.h&gt; +// IMPOSSIBLE +/* It is impossible to swap two literal numbers defined using the +preprocessor directive #define. This is because #define performs simple +text substitution and does not create variables in memory that can be +manipulated or pointed to. */ + +// Using a Function-Like Macro + +#include &lt;stdio.h&gt; + +// Define the SWAP macro. +// The do-while(0) block is a common trick to ensure the macro behaves +// like a single statement, regardless of where it is used (e.g., inside an &#x27;if&#x27; statement). +#define SWAP(a, b, data_type) \ + do { \ + data_type temp = a; \ + a = b; \ + b = temp; \ + } while(0) int main() { - int inp, num, i; - printf(&quot;Please enter the number to get the factors from it : &quot;); - scanf(&quot;%d&quot;, &amp;inp); - - num = abs(inp); - - if (num == 0) { - printf(&quot;\n\n0 has infinitely many factors (all integers).&quot;); - return 1; - } - - printf(&quot;\n\nThe factors of &#x27; %d &#x27; is :- &quot;, inp); - printf(&quot;\nPositive : &quot;); - for (i = 1; i &lt;= num ; i++) if (num % i == 0) printf(&quot; %d&quot;, i); - printf(&quot;\nNegative : &quot;); - for (i = 1; i &lt;= num ; i++) if (num % i == 0) printf(&quot; %d&quot;, -i); - return 0; -} -</code></pre> + int num1 = 15; + int num2 = 42; + + printf(&quot;--- Before Swap ---\n&quot;); + printf(&quot;Number 1 (num1): %d\n&quot;, num1); + printf(&quot;Number 2 (num2): %d\n&quot;, num2); + + // Call the macro, passing the variables and their type + // The preprocessor replaces this line with the block of code defined above. + SWAP(num1, num2, int); + + printf(&quot;\n--- After Swap (using macro) ---\n&quot;); + printf(&quot;Number 1 (num1): %d\n&quot;, num1); + printf(&quot;Number 2 (num2): %d\n&quot;, num2); + + return 0; +}</code></pre> + </div> + </li> + + <li> + <div class="flex items-center p-3 pl-8 hover:bg-gray-50 transition-colors duration-200"> + <svg class="w-6 h-6 text-green-500 mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg> + <span class="text-gray-700">assignment-s-08.c</span> + <div class="ml-auto flex items-center space-x-4"> + <a href="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-08.c" target="_blank" class="p-1 rounded-full text-gray-500 hover:bg-gray-200 hover:text-gray-800 transition-colors" title="View file on GitHub"> + <svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.168 6.839 9.492.5.092.682-.217.682-.482 0-.237-.009-.868-.014-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.031-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.03 1.595 1.03 2.688 0 3.848-2.338 4.695-4.566 4.942.359.308.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.001 10.001 0 0022 12c0-5.523-4.477-10-10-10z" clip-rule="evenodd"></path></svg> + </a> + <button onclick="showCode('code-assignment-secondary-assignment-s-08_c', 'assignment-s-08.c')" class="text-green-600 font-semibold text-sm hover:underline">View Code</button> + </div> + </div> + <div id="code-assignment-secondary-assignment-s-08_c" class="hidden" data-github-url="https://github.com/notamitgamer/bsc/blob/main/assignment-secondary/assignment-s-08.c"> + <pre><code class="language-c">/* Write a program that counts the number of occurrences of each alphabet (A-Z, a-z) in +the text entered using Command-Line Arguments. */ + +#include &lt;stdio.h&gt; +#include &lt;string.h&gt; + +int main(int argc, char *argv[]) +{ + int target[2], i, j, count[2], len; + for (target[0] = &#x27;A&#x27;, target[1] = &#x27;a&#x27;; target[0] &lt;= &#x27;Z&#x27;, target[1] &lt;= &#x27;z&#x27;; target[0]++, target[1]++) + { + count[0] = 0; + count[1] = 0; + for (i = 1; i &lt; argc; i++) + { + len = strlen(argv[i]); + for (j = 0; j &lt; len; j++) + { + if (argv[i][j] == target[0]) + { + count[0]++; + } + if (argv[i][j] == target[1]) + { + count[1]++; + } + } + } + if (count[0]) + { + printf(&quot;\n\&quot;%c\&quot; found %d times.&quot;, target[0], count[0]); + } + if (count[1]) + { + printf(&quot;\n\&quot;%c\&quot; found %d times.&quot;, target[1], count[1]); + } + } + return 0; +}</code></pre> </div> </li> </ul>
© 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