//Finding Prime numbers
#include<stdio.h>
int main(){
int n, i = 3, count, c;
printf("Enter the number of prime numbers required:");
scanf("%d",&n);
if ( n >= 1 ) {
printf("First %d prime numbers are :\n",n);
}
for ( count = 2 ; count <= n ; ){
for ( c = 2 ; c <= i - 1 ; c++ ){
if ( i%c == 0 )
break;
}
if ( c == i ){
printf("%d,",i);
count++;
}
i++;
}
return 0;
}
Result :
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন