bsc

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

commit b4c0e5616246ad0729a5063ce70a9420e09661b8
parent 4196b3665c0e96f8d739b7b90afd2750d240f3d7
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Wed,  3 Sep 2025 19:54:23 +0530

Add files via upload
Diffstat:
Ac/1.c | 28++++++++++++++++++++++++++++
Ac/1.exe | 0
Ac/2.c | 25+++++++++++++++++++++++++
Ac/2.exe | 0
Ac/3.c | 26++++++++++++++++++++++++++
Ac/3.exe | 0
Ac/4.c | 33+++++++++++++++++++++++++++++++++
Ac/4.exe | 0
Ac/5.c | 30++++++++++++++++++++++++++++++
Ac/5.exe | 0
Ac/6.c | 24++++++++++++++++++++++++
Ac/6.exe | 0
Ac/codesnapshot/1.png | 0
Ac/codesnapshot/2.png | 0
Ac/codesnapshot/3.png | 0
Ac/codesnapshot/4.png | 0
Ac/codesnapshot/5.png | 0
Ac/codesnapshot/6.png | 0
18 files changed, 166 insertions(+), 0 deletions(-)

diff --git a/c/1.c b/c/1.c @@ -0,0 +1,28 @@ +// Write a program (WAP) to print the sum and product of digits of an integer. + +#include<stdio.h> + +int main() { + int inp, result_sum = 0, result_product = 1, temp; + printf("Please enter the number : "); + scanf("%d",&inp); + printf("\n"); + + if (inp < 0) { + printf("\nPlease enter a valid non negetive integer."); + return 0; + } + + temp = inp; + while (temp != 0 ) { + result_sum = result_sum + (temp % 10); + result_product = result_product * (temp % 10); + temp = temp / 10; + } + + printf("\nSum of the digits of the input number '%d' is : %d" + "\nProduct of the digits of the input number '%d' is : %d", + inp, result_sum, inp, result_product); + return 0; +} + diff --git a/c/1.exe b/c/1.exe Binary files differ. diff --git a/c/2.c b/c/2.c @@ -0,0 +1,25 @@ +//WAP to reverse a non-negative integer. + +#include<stdio.h> + +int main() { + int inp, result = 0, temp; + printf("PLease enter the number you want to reverse : "); + scanf("%d",&inp); + printf("\n"); + + if (inp < 0) { + printf("\nPlease enter a non negetive integer."); + return 0; + } + + temp = inp; + while ( temp != 0) { + result = (result * 10) + (temp % 10); + temp = temp / 10; + } + + printf("\nReverse of the input '%d' is : %d", inp, result); + return 0; +} + diff --git a/c/2.exe b/c/2.exe Binary files differ. diff --git a/c/3.c b/c/3.c @@ -0,0 +1,26 @@ +//WAP to compute the sum of the first n terms of the following series,S =1-2+3- 4+5...... + +#include<stdio.h> + +int main() { + int n, result = 0, temp, i; + printf("Please enter the value for 'n' for this series 's = 1-2+3-4+5-....': "); + scanf("%d",&n); + printf("\n"); + + if (n <= 0) { + printf("\nPlease enter a positive integer."); + return 0; + } + + for (i = 1; i<= n; i++) { + if (i % 2 == 0) { + result = result - i; + } + else { + result = result + i; + } + } + + printf("\nAns : %d", result); +} diff --git a/c/3.exe b/c/3.exe Binary files differ. diff --git a/c/4.c b/c/4.c @@ -0,0 +1,33 @@ +/*Write a function to find whether a given no. is prime or not. +Use the same to generate the prime numbers less than 100.*/ + +#include<stdio.h> + +int isPrime(int inp) { + int i, is_prime = 1; + + if (inp < 2) is_prime = 0; + + for (i = 2; i <= inp / 2; i++) if (inp % i == 0) { + is_prime = 0; + break; + } + + return is_prime; +} + + +int main() { + int inp, i; + printf("Enter the number you want to check : "); + scanf("%d",&inp); + printf("\n"); + + if (isPrime(inp)) printf("\nGiven input '%d' is a Prime Number.",inp); + else printf("\nGiven input '%d' is not a Prime Number.",inp); + + printf ("\nSeris of prime number below : "); + for (i = 2; i < 100; i++) if (isPrime(i)) printf(" %d",i); + + return 0; +} diff --git a/c/4.exe b/c/4.exe Binary files differ. diff --git a/c/5.c b/c/5.c @@ -0,0 +1,30 @@ +/*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.*/ + +#include<stdio.h> +#include<string.h> + +int isPalindrome(char inp[]) { + int len = strlen(inp); + int i = 0; //starting point + int j = len - 1; //end point + + while (i < j) { + if (inp[i] != inp[j]) { + return 0; + } + i++; + j--; + } + + return 1; +} + +int main() { + char inp[20]; + printf("Enter the number : "); + scanf("%s",inp); + if (isPalindrome(inp)) printf("\n\nInput '%s' is a Palindrome number.", inp); + else printf("\n\nInput '%s' is not a Palindrome number.", inp); + return 0; +} diff --git a/c/5.exe b/c/5.exe Binary files differ. diff --git a/c/6.c b/c/6.c @@ -0,0 +1,24 @@ +// WAP to compute the factors of a given number + +#include<stdio.h> +#include<stdlib.h> + +int main() { + int inp, num, i; + printf("Please enter the number to get the factors from it : "); + scanf("%d", &inp); + + num = abs(inp); + + if (num == 0) { + printf("\n\n0 has infinitely many factors (all integers)."); + return 0; + } + + printf("\n\nThe factors of ' %d ' is :- ", inp); + printf("\nPositive : "); + for (i = 1; i <= num ; i++) if (num % i == 0) printf(" %d", i); + printf("\nNegative : "); + for (i = 1; i <= num ; i++) if (num % i == 0) printf(" %d", -i); + return 0; +} diff --git a/c/6.exe b/c/6.exe Binary files differ. diff --git a/c/codesnapshot/1.png b/c/codesnapshot/1.png Binary files differ. diff --git a/c/codesnapshot/2.png b/c/codesnapshot/2.png Binary files differ. diff --git a/c/codesnapshot/3.png b/c/codesnapshot/3.png Binary files differ. diff --git a/c/codesnapshot/4.png b/c/codesnapshot/4.png Binary files differ. diff --git a/c/codesnapshot/5.png b/c/codesnapshot/5.png Binary files differ. diff --git a/c/codesnapshot/6.png b/c/codesnapshot/6.png Binary files differ.
© 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