commit 4a50a0e69bd200b67aa455157524a9f3c4dca16d
parent 38f9e5c61742d77b18395cd5f86aa97ccbc94f3d
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Wed, 3 Sep 2025 14:21:14 +0530
Add files via upload
Diffstat:
6 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/practice-c/codesnapshot/defprime.png b/practice-c/codesnapshot/defprime.png
Binary files differ.
diff --git a/practice-c/codesnapshot/rev.png b/practice-c/codesnapshot/rev.png
Binary files differ.
diff --git a/practice-c/codesnapshot/s=1-2+3-4+5-6.png b/practice-c/codesnapshot/s=1-2+3-4+5-6.png
Binary files differ.
diff --git a/practice-c/codesnapshot/sumofdigit.png b/practice-c/codesnapshot/sumofdigit.png
Binary files differ.
diff --git a/practice-c/defprime.c b/practice-c/defprime.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/practice-c/defprime.exe b/practice-c/defprime.exe
Binary files differ.