Program to check Prime numbers in C language | C program to check whether a number is Prime or Not.

preview_player
Показать описание
In this video a program in C language is demonstrated to check whether the given number is Prime or Not. After watching this video you will be able to write a program to check whether the given number is a Prime number or not. subscribe @Tech Travel for more informative videos like this.

#ccode , #codeninjarebirth , #coding #clanguagefullcourse #codeninja #cprogrammingforbeginners
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

int main() {
int num, i, a= 1;

printf("Enter a number: ");
scanf("%d", &num);

if (num <= 1) {
a = 0;
} else {
for (i = 2; i < num; i++) {
if (num % i == 0) {
a = 0;

}
}
}

if (a)
{
printf("%d is a prime number\n", num);
}
else
{
printf("%d is not a prime number\n", num);
}

return 0;
}

alone
Автор

can you do the psuedocode verson in this

karlenegreene
Автор

Nice code but I have a suggestion
If you check for(i=1:i<n/2:i++) it will take less time and result will be same

athegenius
Автор

Jesus is the only true living GOD
Jesus is the only way to heaven
Accept Jesus Escape Hell

Angelraaga
Автор

Do it using only two variables i and n

vatsvlogs
Автор

can you plz explain me its logic plz it helps me alot to understand

MemesKiduniya
Автор

Here why you taking ( count==2) this step is not understanding

KeerthanabmKeerthi