├── Day1_challenge ├── Quest_2 ├── Quest_3 ├── Quest_4 ├── Quest_5 ├── Quest_6 ├── hello ├── hello.c ├── q5.c ├── q4.c ├── Quest_4.c ├── Quest_5.c ├── q2.c ├── q6.c ├── Quest_2.c ├── Quest_3.c ├── q3.c └── Quest_6.c ├── Cracking.C.Programming.Interview.pdf ├── Sams Teach Yourself C in 21 Days - 6th Ed (Bradley L. Jones, Peter Aitken).pdf └── README.md /Day1_challenge/Quest_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/Quest_2 -------------------------------------------------------------------------------- /Day1_challenge/Quest_3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/Quest_3 -------------------------------------------------------------------------------- /Day1_challenge/Quest_4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/Quest_4 -------------------------------------------------------------------------------- /Day1_challenge/Quest_5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/Quest_5 -------------------------------------------------------------------------------- /Day1_challenge/Quest_6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/Quest_6 -------------------------------------------------------------------------------- /Day1_challenge/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Day1_challenge/hello -------------------------------------------------------------------------------- /Day1_challenge/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | printf("Hello, World!\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /Cracking.C.Programming.Interview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Cracking.C.Programming.Interview.pdf -------------------------------------------------------------------------------- /Day1_challenge/q5.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | do_it() is not defined 4 | */ 5 | int main( void ) 6 | { 7 | printf( "This is a program with a " ); 8 | do_it( "problem!"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /Day1_challenge/q4.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | int main(void); is what caused the problem 4 | */ 5 | int main( void ) 6 | { 7 | printf( "Keep looking!" ); 8 | printf( "You\'ll find it!\n" ); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /Sams Teach Yourself C in 21 Days - 6th Ed (Bradley L. Jones, Peter Aitken).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dutkulang/ALX-21-days-coding-challenge/HEAD/Sams Teach Yourself C in 21 Days - 6th Ed (Bradley L. Jones, Peter Aitken).pdf -------------------------------------------------------------------------------- /Day1_challenge/Quest_4.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - This programm prints out two strings 4 | * 5 | * Return 0 successful 6 | */ 7 | 8 | int main( void ) 9 | { 10 | printf( "Keep looking!" ); 11 | printf("You’ll find it!\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Day1_challenge/Quest_5.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - Thi function prints out a string 4 | * Return: 0 success 5 | */ 6 | int main( void ) 7 | { 8 | printf( "This is a program with a "); 9 | printf("problem!\n"); 10 | /* do_it( “problem!”); This function "do_it" is not defined */ 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Day1_challenge/q2.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | program asks for radius then calculates the Area 4 | */ 5 | 6 | int radius, area; 7 | int main( void ) 8 | { 9 | printf("Enter radius (i.e. 10): "); 10 | scanf( "%d", &radius ); 11 | area = (int) (3.14159 * radius * radius); 12 | printf( "\n\nArea = %d\n", area ); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Day1_challenge/q6.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | the program will print empty spaces SOH 4 | */ 5 | int x, y; 6 | int main( void ) 7 | { 8 | for ( x = 0; x < 10; x++) 9 | { 10 | printf( "\n" ); 11 | for ( y = 0; y < 10; y++ ){ 12 | // printf( "X"); 13 | printf( "%c", 1 ); 14 | } 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Day1_challenge/Quest_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - asks the user for a radius and then uses it to find area 4 | * 5 | * Return: 0 successful 6 | */ 7 | 8 | int radius, area; 9 | 10 | int main( void ) 11 | { 12 | printf( "Enter radius (i.e. 10): " ); 13 | scanf( "%d", &radius ); 14 | area = (int) (3.14159 * radius * radius); 15 | printf( "\n\nArea = %d\n", area ); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Day1_challenge/Quest_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - This program shows how the transfer 4 | * of action in a nested loop works 5 | * 6 | * Return: 0 successful 7 | */ 8 | 9 | 10 | int main( void ) 11 | { 12 | int x, y; 13 | 14 | for ( x = 0; x < 10; x++) 15 | { 16 | for ( y = 0; y < 10; y++ ) 17 | { 18 | printf( "X" ); 19 | } 20 | printf("\n"); 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Day1_challenge/q3.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * Shows how transfer of execution happens 4 | * The outer loop executes once as the inner loop executes 10 times the return execution to the outer loop. 5 | */ 6 | int x, y; 7 | int main( void ) 8 | { 9 | for ( x = 0; x < 10; x++) 10 | { 11 | printf( "\n" ); 12 | for ( y = 0; y < 10; y++ ){ 13 | printf( "X"); 14 | } 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Day1_challenge/Quest_6.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - This program shows how the transfer 4 | * of action in a nested loop works 5 | * 6 | * Return: 0 successful 7 | */ 8 | 9 | 10 | int main( void ) 11 | { 12 | int x, y; 13 | 14 | for ( x = 0; x < 10; x++) 15 | { 16 | for ( y = 0; y < 10; y++ ) 17 | { 18 | printf("%c", 1 );//printf( "X" ); 19 | } 20 | /* "printf("%c", 1);*/ printf("\n"); 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ALX 21 days coding challenge 2 | ALX students 21 days of C challenges based on Sams teach yourself C in 21 days book, a PDF version can be found in this repo. 3 | 4 | These challenges are 100% voluntary and for those who wish to improve on their C programming skills. You may come up with the solutions alone or with the help of external persons and tools. 5 | 6 | ### How to contribute / participate in the challenge 7 | 8 | 1. Fork the main repo from [ALX-21-days-coding-challenge](https://github.com/dutkulang/ALX-21-days-coding-challenge) 9 | 10 | 2. clone your forked copy of the repo. 11 | 12 | 3. create your own development branch after your own name 13 | 14 | ```sh 15 | # An example could be that my name is Betty Kimba 16 | 17 | # git branch 18 | 19 | $ git branch betty-kimba 20 | ``` 21 | 4. Switch to your created branch. 22 | 23 | ```sh 24 | $ git switch betty-kimba 25 | ``` 26 | 5. Create a folder for the challenge of your choice. 27 | ```sh 28 | $ mkdir -p Day2_challenge 29 | 30 | $ cd Day2_challenge 31 | ``` 32 | 6. create a `notes.md` file(optional) and your solution files 33 | 34 | At times as we code, alot of research is done before-hand and during the actual coding process. `notes.md` is the right place to include those findings. 35 | 36 | 7. Remember to use Betty. 37 | 8. Push your working branch to GitHub. 38 | 39 | ```sh 40 | # -u flag to set upstream branch 41 | # git push -u origin 42 | $ git push -u origin betty-kimba 43 | ``` 44 | 9. Contribute your work to the main repo by creating a pull request. 45 | 46 | Give your pull request a title and comment. 47 | ```txt 48 | Title: `Solution for Day2_challenge` 49 | comment: " 50 | - Dynamically allocated memory using malloc 51 | - used strcpy to copy the a string into the allocated memory 52 | - used free to free up the allocated heap memory. 53 | " 54 | ``` 55 | 10. Give this challenge repo a and continue your `DO HARD THINGS` journey. 56 |
57 | 58 | `The zen of ALX, by Dut Kulang` 59 | 60 | As you do hard things 61 | 62 | Remember that aunty Betty is final 63 | 64 | because she is the BOSS 65 | 66 | you must make her HAPPY 67 | 68 | Your code MUST be to her taste 69 | 70 | or suffer in her hands 71 | 72 | her pet Kimba will smell and bite 73 | 74 | if you dare try to cheat. 75 | 76 | 80 hours a week is real not a joke, 77 | 78 | datelines willl police and enforce it. 79 | 80 | To defer does not make you failure 81 | 82 | even the smartest minds must rest too 83 | 84 | semi-colons are the root cause of all evil 85 | 86 | don't forget them at end of your lines. 87 | 88 | C will make see 89 | 90 | ask Cpython what it saw 91 | 92 | while true, we 93 | 94 | Do hard things --------------------------------------------------------------------------------