I have one more problem:

I need to displey number of prime numbers. Number is enetered from user.

I need to use only while loops.

I tried, but having problems-infinite loop

ThanksCode:#include <stdio.h> int main() { int n,i=1,prime=1; printf("How many prime numbers do you want: "); scanf("%d",&n); while(n) { i=1; while(i<=prime) { if(prime%i==0) break; i++; } if(prime==i) { printf(" %d",prime); n--; } prime++; } return 0; }