answersLogoWhite

0

Print first ten prime numbers in c?

User Avatar

Anonymous

14y ago
Updated: 10/17/2024

// simple program to generate first ten prime numbers

#include<stdio.h>

#include<conio.h>

void main()

{

int c,i,j,n;

clrscr();

for(i=2;i<30;i++)

{

c=0;

for(j=2;j<i;j++)

{

if(i%j==0)

{c=c+1;

}

}

if(c==0)

printf("%d",i);

}

getch();

}

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

RossRoss
Every question is just a happy little opportunity.
Chat with Ross
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine

Add your answer:

Earn +20 pts
Q: Print first ten prime numbers in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp