Skip to content

Commit 48bda01

Browse files
committed
Added few more files
1 parent ad720ae commit 48bda01

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

C_Begineer/11-CBegineer.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
5+
int main() {
6+
7+
char firstName[20];
8+
char crush[20];
9+
int numberOfBabies;
10+
11+
//Using scanf to get user Input
12+
printf("What is your name?\n");
13+
scanf("%s", &firstName);
14+
15+
printf("Who you gonna get marry to? \n");
16+
scanf("%s", &crush);
17+
18+
printf("How many kids will you have? \n");
19+
scanf("%d", &numberOfBabies);
20+
21+
printf("%s and %s are in love and have %d babies \n", firstName, crush, numberOfBabies);
22+
return 0;
23+
}

C_Begineer/12.CBegineer.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
5+
int main() {
6+
7+
//Math operators
8+
// + Addition
9+
// - Subtraction
10+
// / Divide
11+
// * Multiplication
12+
// % Modulos or remainder
13+
14+
int a = 86;
15+
int b = 21;
16+
17+
//Integer result (INT)
18+
printf("%d \n", a/b);
19+
20+
float c = 86.0;
21+
float d = 21.0;
22+
23+
//float resukt (FLOAT)
24+
printf("%f \n", c/d);
25+
26+
return 0;
27+
}

C_Begineer/13.CBegineer.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
5+
int main() {
6+
7+
// Order of math operation
8+
// First inside brackets
9+
// Then * or /
10+
// Then + or -
11+
12+
int a = 4 + 2 * 6;
13+
14+
printf("Result: %d \n", a);
15+
16+
a = (4 + 2) * 6;
17+
printf("Result: %d \n", a);
18+
19+
return 0;
20+
}

0 commit comments

Comments
 (0)