Binaries; Age; Age2; Age3; Average Grade; Calculator; first-program; Full Name, Age, and Gender; Rectangle; Traingle; Triangle2; User Input; User Input2; Variables; Year

This commit is contained in:
Out Of Ideas 2024-01-08 21:00:47 -06:00
parent 75ce99c7ef
commit 4c91ebba87
29 changed files with 165 additions and 0 deletions

8
Age.c Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("I am %d years old\n", 21);
return 0;
}

8
Age2.c Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("I am %d years old \nHe is %d years old\n", 21, 22);
return 0;
}

8
Age3.c Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("I am %d years old \nHe is %d years old\n", 21);
return 0;
}

8
Average Grade.c Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Average grade: %1f\n", 93.7);
return 0;
}

BIN
Binaries/Age Executable file

Binary file not shown.

BIN
Binaries/Age2 Executable file

Binary file not shown.

BIN
Binaries/Age3 Executable file

Binary file not shown.

BIN
Binaries/Average Grade Executable file

Binary file not shown.

BIN
Binaries/Caulculator Executable file

Binary file not shown.

Binary file not shown.

BIN
Binaries/Rectangle Executable file

Binary file not shown.

BIN
Binaries/Triangle Executable file

Binary file not shown.

BIN
Binaries/Triangle2 Executable file

Binary file not shown.

BIN
Binaries/User Input Executable file

Binary file not shown.

BIN
Binaries/User Input2 Executable file

Binary file not shown.

BIN
Binaries/Variables Executable file

Binary file not shown.

BIN
Binaries/Year Executable file

Binary file not shown.

BIN
Binaries/first-and-last-name Executable file

Binary file not shown.

BIN
Binaries/first-program Executable file

Binary file not shown.

11
Caulculator.c Normal file
View file

@ -0,0 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%d + %d = %d\n", 5, 2, 5+2);
printf("%d - %d = %d\n", 5, 2, 5-2);
printf("%d * %d = %d\n", 5, 2, 5*2);
printf("%d / %d = %d + %d / 2 \n", 5, 2, 5/2, 5 % 2);
return 0;
}

View file

@ -0,0 +1,7 @@
#include <stdio.h>
int main()
{
printf("Full name: Henry Olson \nAge: 15 \nGender: Male\n");
return 0;
}

20
Rectangle.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
float l, w; /* Length and Width */
printf("Rectangle Area\n");
printf("Length: ");
scanf("%f", &l);
printf("width: ");
scanf("%f", &w);
printf("Area: %f\n", l*w); /* Area = length x width */
return 0;
}

20
Triangle.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
int main()
{
printf(" /\\\n");
printf(" / \\\n");
printf(" / \\\n");
printf(" / \\\n");
printf(" / \\\n");
printf("/__________\\\n");
return 0;
}
/* /\
/ \
/ \
/ \
/ \
/__________\ */

14
Triangle2.c Normal file
View file

@ -0,0 +1,14 @@
#include <stdio.h>
int main()
{
printf(" /\\\n / \\\n / \\\n / \\\n / \\\n/__________\\\n");
return 0;
}
/* /\
/ \
/ \
/ \
/ \
/__________\ */

9
User Input.c Normal file
View file

@ -0,0 +1,9 @@
#include <stdio.h>
int main()
{
char myString[100];
scanf("%s", &myString);
printf("%s\n", &myString);
return 0;
}

10
User Input2.c Normal file
View file

@ -0,0 +1,10 @@
#include <stdio.h>
int main()
{
char myString[100];
printf("Message: ");
fgets(myString, sizeof(myString), stdin);
printf("%s\n", myString);
return 0;
}

12
Variables.c Normal file
View file

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int num;
printf("What is num: ");
scanf("%d", &num);
printf("num is %d\n", num);
return 0;
}

20
Year.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int yr; /* Year */
int byr; /* Birth Year */
printf("What is the current year: ");
scanf("%d", &yr);
printf("What is your year of birth: ");
scanf("%d", &byr);
printf("Current year: %d\n", yr);
printf("Your year of birth %d\n", byr);
return 0;
}

10
first-program.c Normal file
View file

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Henry Olson\n");
return 0;
}