76 lines
No EOL
1.8 KiB
C
76 lines
No EOL
1.8 KiB
C
// Welcome to my journey of learning the fuckass language that is C
|
|
#include <stdio.h>
|
|
|
|
int multiply(int num_one, int num_two) {
|
|
int result = num_one*num_two;
|
|
return result;
|
|
}
|
|
|
|
int main() {
|
|
// HELLO WORLD SECTION
|
|
printf("HELLO WORLD BELOW:\n"); // DIVIDER
|
|
char first[] = "Hello";
|
|
char second[] = "World";
|
|
printf("%s %s", first, second);
|
|
|
|
// IF/ELSE STATEMENT
|
|
printf("\n\nIF/ELSE STATEMENT BELOW:\n"); // DIVIDER
|
|
int num = 67;
|
|
if (69<num) {
|
|
printf("69 is smaller than %d ", num);
|
|
} else {
|
|
printf("69 is larger than %d ", num);
|
|
}
|
|
|
|
// SWITCH STATEMENT
|
|
printf("\n\nSWITCH STATEMENT BELOW:\n"); // DIVIDER
|
|
int meme = 1337;
|
|
switch (meme) {
|
|
case 13:
|
|
printf("she said she was twelve!");
|
|
break;
|
|
case 21:
|
|
printf("haha 9+10");
|
|
break;
|
|
case 67:
|
|
printf("lolol 67");
|
|
break;
|
|
case 69:
|
|
printf("nice");
|
|
break;
|
|
case 420:
|
|
printf("weed..");
|
|
break;
|
|
case 1337:
|
|
printf("you are elite");
|
|
break;
|
|
case 80085:
|
|
printf("do NOT put this number into a calculator");
|
|
break;
|
|
default:
|
|
printf("Sorry I do not recognise this meme");
|
|
break;
|
|
}
|
|
|
|
// WHILE LOOP
|
|
printf("\n\nWHILE LOOP BELOW:\n"); // DIVIDER
|
|
int a=1,b=7;
|
|
while (a!=b) {
|
|
a++;
|
|
b-=1;
|
|
printf("int a=%d AND int b=%d\n", a, b);
|
|
}
|
|
|
|
// FOR LOOP
|
|
printf("\n\nFOR LOOP BELOW:\n"); // DIVIDER
|
|
for (int i=0; i<=3; i++) {
|
|
printf("i=%d\n", i);
|
|
}
|
|
|
|
// FUNCTION
|
|
printf("\n\nFUNCTION (MULTIPLY) BELOW:\n"); // DIVIDER
|
|
printf("%d * %d = %d", 5, 30, multiply(5,30));
|
|
|
|
// END
|
|
return 0;
|
|
} |