Non si sa come, ma funziona
This commit is contained in:
parent
4fad4e619c
commit
dcfef6f946
26
main.c
26
main.c
@ -1 +1,25 @@
|
|||||||
#include <stdio.h>\n\nint main(){\n\n}
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef int bool;
|
||||||
|
|
||||||
|
const int true = 1;
|
||||||
|
const int false = 0;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int numero;
|
||||||
|
bool divisibile = false;
|
||||||
|
printf("Inserire un numero: ");
|
||||||
|
scanf("%i", &numero);
|
||||||
|
|
||||||
|
for (int i = 2; i < numero - 1 && divisibile == false; i++){
|
||||||
|
if(numero%i==0){
|
||||||
|
divisibile = true;
|
||||||
|
printf("%i non è primo", numero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(divisibile==false){
|
||||||
|
printf("Il numero è primo.");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user