Lab1 Complete
This commit is contained in:
parent
c3b158383c
commit
a604b29e34
21
RountreeLabs/Lab01/isPrime.c
Normal file
21
RountreeLabs/Lab01/isPrime.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user