#include <stdio.h>

void n_primos(int v[], int n){
	int count = 0;
	int num = 2;
	
	while (count < n){
	int primo = 1;
	for(int i = 2; i < n; i++){
		if(num % i == 0){
			primo = 0;
			break;
			}
		}
		if (primo){
			v[count] = num;
			count++;
		} 
		num++;
	} 
}

void imprime_vetor(int v[], int n){
	for(int i = 0; i < n; i++){
		printf("%d\n", v[i]);
	} printf("\n");
}


int main(){
	
	int n;
	scanf("%d", &n);
	int v[n];
	n_primos(v, n);
	imprime_vetor(v, n);
	return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: