C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.

Write a C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.

Solution For C Program:
#include <stdio.h>

int determina_primo(int a){

int i;
int dato;
int primo, trovato;

primo=1;
trovato=0;

for (i=0; i<a; i++){

printf("Inserire il valore: %d\n", i+1);
scanf("%d", &dato);

int dividendo;

for(dividendo=2; dividendo<dato; dividendo++){

if (dato%dividendo==0)
primo=0;
}

if (primo==1){
printf("È un numero primo.\n");
trovato=1;
}

}

if (trovato==0){
printf("Non è stato trovato alcun numero primo");
}
return 0;
}

int main(void){
int a;

printf("Inserisci il numero di numeri da inserire: \n");
scanf("%d", &a);

determina_primo(a);
return 0;
}


Learn More :