This commit is contained in:
2024-02-24 15:17:46 +03:00
parent f5aa8d53b6
commit 3a67cb72cc
4 changed files with 90 additions and 0 deletions

28
DeitelC/IsPrime.c Normal file
View File

@@ -0,0 +1,28 @@
#include <stdio.h>
void isPrime(int number) {
int a = 1;
int count = 0;
while (a < number) {
if(number%a == 0) {
count += 1;
a++;
} else {
a++;
}
}
if(count == 1) {
printf("%s\n", "Yes it's a Prime");
} else {
printf("%s\n", "No it isn't a Prime");
}
}
int main(void) {
int number;
printf("%s\n", "Enter a integer!");
scanf("%d", &number);
isPrime(number);
}