Created
October 8, 2015 12:13
-
-
Save hjanuschka/372a546af73f7900d537 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MY_TRUE 0 | |
#define MY_FALSE -1 | |
#define MAX_NUM 20 | |
int num_is_dividable(int num); | |
int main(int argc, char ** argv) { | |
int current=1; | |
int result=MY_FALSE; | |
while(num_is_dividable(current) == MY_FALSE) { | |
current++; | |
} | |
printf("DONE: %d\n", current); | |
} | |
int num_is_dividable(int num) { | |
int x; | |
int is_dividable=MY_TRUE; | |
for(x = 1; x<=MAX_NUM; x++) { | |
if(num%x != 0) { | |
is_dividable=MY_FALSE; | |
} | |
} | |
if(is_dividable == MY_FALSE) { | |
return MY_FALSE; | |
} else { | |
return num; | |
} | |
return MY_FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment