Print First N Prime Number In C Language | C Language Tutorial

preview_player
Показать описание
prime no program in c programming |
c language tutorial by abhishek pathak
========================================
important videos :-
=========================================
follows us on :-
=========================================
follows Abhishek pathak :-
=========================================
important tag :-
#clanguage #cprogram #prime_no
c language
c program
c++
python
java
future of web development
creative coders
creative_coders
like share comment
Рекомендации по теме
Комментарии
Автор

It's not working There seem to be a few errors in the code you provided. Here is a corrected version of the code that should work:
#include <stdio.h>

int main()
{
int num, p = 2, i, count = 0;

printf("Enter the number of prime numbers you want: ");
scanf("%d", &num);

while (count < num)
{
for (i = 2; i < p; i++)
{
if (p % i == 0)
break;
}

if (i == p)
{
printf("%d ", p);
count++;
}

p++;
}

return 0;
}

ridddssss
Автор

kya app iss program ka for loop samjha sakte hai?
Kyuki p aur i har time equal hoga. Aur for loop terminate ho jayega.
Please explain it to me.

gamerbudgies