-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 954447d
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
int main(void) | ||
{ | ||
int a = 3; | ||
int b, c = 2; | ||
b = a + c; | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) | ||
{ | ||
int a = 3; | ||
int b, c = 2; | ||
b = a + c; | ||
printf("%d\n", b); | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
int collatz(int n) { | ||
if (n == 1) return 1; | ||
if (n % 2) return collatz(3 * n + 1); | ||
else return collatz(n / 2); | ||
} | ||
|
||
|
||
int main(int argc, char const *argv[]){ | ||
printf("%d\n", collatz(atoi(argv[1]))); | ||
return 0; | ||
} |