diff --git a/Average Grade2.c b/Average Grade2.c new file mode 100644 index 0000000..6925e97 --- /dev/null +++ b/Average Grade2.c @@ -0,0 +1,24 @@ +#include +#include + +int main() { + printf("Average Grade\n"); + + int g1, g2, g3; /* Grade 1, Grade 2, and Grade 3 */ + + + printf("Enter Your First Grade: "); + scanf("%d", &g1); + + printf("Enter Your Second Grade: "); + scanf("%d", &g2); + + printf("Enter Your Third Grade: "); + scanf("%d", &g3); + + printf("Average Grade = %.2f\n", (g1 + g2 + g3) / 3.0); /* calculates and prints the avergage grade */ + + return 0; +} + + diff --git a/Binaries/Average Grade2 b/Binaries/Average Grade2 new file mode 100755 index 0000000..1be1993 Binary files /dev/null and b/Binaries/Average Grade2 differ diff --git a/Binaries/Casting b/Binaries/Casting new file mode 100755 index 0000000..3276d88 Binary files /dev/null and b/Binaries/Casting differ diff --git a/Binaries/Rectangle2 b/Binaries/Rectangle2 new file mode 100755 index 0000000..24e166d Binary files /dev/null and b/Binaries/Rectangle2 differ diff --git a/Binaries/Weather b/Binaries/Weather new file mode 100755 index 0000000..3bc1f71 Binary files /dev/null and b/Binaries/Weather differ diff --git a/Casting.c b/Casting.c new file mode 100644 index 0000000..434ddba --- /dev/null +++ b/Casting.c @@ -0,0 +1,13 @@ +#include +#include + +int main() { + int num1 = 5, num2 = 2; + float result = (float)num1 / num2; + + printf("Result = %.2f\n", result); + + return 0; +} + + diff --git a/Rectangle2.c b/Rectangle2.c new file mode 100644 index 0000000..a262854 --- /dev/null +++ b/Rectangle2.c @@ -0,0 +1,26 @@ +/* Rectange Perimeter + * + * Rectangle Perimeter is a program that caulculates + * the perimeter of a rectangle based on the provided + * length and width. + */ +#include +#include + +int main() { + float l, w; /* Length and Width */ + + printf("Rectangle Peremiter\n"); + + printf("Length: "); + scanf("%f", &l); + + printf("width: "); + scanf("%f", &w); + + printf("Perimeter: %f\n", 2 * (l + w)); /* Peremiter = Length x Width */ + + return 0; +} + + diff --git a/Weather.c b/Weather.c new file mode 100644 index 0000000..e5ad01f --- /dev/null +++ b/Weather.c @@ -0,0 +1,42 @@ +#include +#include + +int main() { + int u, d, c; /* Temperature Unit and # of Dergreesn */ + + printf("Wheather\n"); + + printf("(1) Celcius -> Fahrenheit \n(2) Fahrenheit -> Celcius \n(1|2) "); + scanf("%d", &u); + + /* Convert Celcius to Fahrenheit */ + if (u == 1) { + printf("Celcius -> Fahrenheit\n"); + + printf("Enter temprature in Celcius: "); + scanf("%d", &d); + + printf("Fahrenheit dergees = %.2f\n", d * 1.8 + 32); /* Fahrenheit Degrees */ + } + + /* Convert Fahrenheit to Celcius */ + if (u == 2) { + printf("Fahrenheit -> Celcius\n"); + + printf("Enter temprature in Fahrenheit: "); + scanf("%d", &d); + + printf("Celcius dergees = %.2f\n", (d - 32) / 1.8); /* Celcius Degrees */ + } + + + if (u != 1 && u != 2) { + printf("Error: Invalid Argument\n"); + + exit(1); + } + + return 0; +} + +