Lab1 Complete

This commit is contained in:
lunarised 2019-04-19 15:41:35 +12:00
parent c3b158383c
commit a604b29e34

View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int is_prime(int n){
int i;
for(i=2;i<n;i++){
if(n%i == 0){
return 0;
}
}
return 1;
}
int main(void){
int n = 2;
for (n = 2; n < 100; n++){
if(is_prime(n)){
printf("%d\n", n);
}
}
return EXIT_SUCCESS;
}