# Create a Program to Implement Geometry in C++ Assignment Solution.

## Instructions

Objective
Write a C++ assignment program to implement geometry.

## Requirements and Specifications

This program works and I need to add two additional functions (functions are below):
/* C Program to Calculate Square, Square root, Triangle Perimeter and Grade Average */
```#include #include int Calculate_Square(int Number); float Calculate_Perimeter_Triangle(float a, float b, float c); float Calculate_Grade(float grade1, float grade2, float grade3, float grade4); int main() { int number, Square; float a,b,c,Triangle, Square_Root; float grade1, grade2, grade3, grade4, Grade; printf(" \n Please Enter any integer Value : "); scanf("%d", &number); Square = Calculate_Square(number); printf("\n Square of a given number %d = %d\n", number, Square); /* Square Root */ printf("The square root of your number %d is %f\n",number, sqrt(number)); printf("\nPlease Enter three sides of triangle\n"); scanf("%f%f%f",&a,&b,&c); printf("Enter 4 grade values for your course:\n"); scanf("%f%f%f%f",&grade1,&grade2,&grade3,&grade4); Grade = Calculate_Grade(grade1, grade2, grade3, grade4); printf("Your grade average is %f\n",Grade); /* Triangle */ Triangle = Calculate_Perimeter_Triangle(a,b,c); printf("Area of triangle is %f\n", Triangle); return 0; } int Calculate_Square(int Number) { return Number * Number; } float Calculate_Perimeter_Triangle(float a, float b, float c) { float s, Perimeter; Perimeter = a+b+c; return Perimeter; } float Calculate_Grade(float g1, float g2, float g3, float g4) { Please add Fahrenheit to Celsius conversion: int main() { float celsius, fahrenheit; printf("Please Enter the temperature in Fahrenheit: \n"); scanf("%f", &fahrenheit); // Convert the temperature from f to c formula celsius = (fahrenheit - 32) * 5 / 9; //celsius = 5 *(fahrenheit - 32) / 9; //celsius =(fahrenheit-32) * 0.55556; printf("\n %.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius); return 0; } Please Add this #include #include #include int main() { printf("Enter your name: "); char name[32]; fgets(name, 32, stdin); name[strlen(name)-1] = '\0'; printf("Hello, %s!\n", name); return EXIT_SUCCESS; }} ```

Source Code

/* C Program to Calculate Square, Square root, Triangle Perimeter and Grade Average */

```#include #include int Calculate_Square(int Number) { return Number*Number; } float Calculate_Perimeter_Triangle(float a, float b, float c) { return a + b + c; } float Calculate_Grade(float grade1, float grade2, float grade3, float grade4) { return (grade1+grade2+grade3+grade4)/4; } int main() { int number, Square; float a,b,c,Triangle, Square_Root; float grade1, grade2, grade3, grade4, Grade; float celsius, fahrenheit; /* Square*/ printf(" \n Please Enter any integer Value : "); scanf("%d", &number); Square = Calculate_Square(number); printf("\n Square of a given number %d = %d\n", number, Square); /* Square Root */ printf("\n The square root of your number %d is %f\n",number, sqrt(number)); /* Triangle Perimeter*/ printf("\n Please Enter three sides of triangle\n"); scanf("%f", &a); scanf("%f", &b); scanf("%f", &c); Triangle = Calculate_Perimeter_Triangle(a,b,c); printf("\n The Perimeter of the Triangle %0.2f\n", Triangle); /* Grades Average*/ printf("\n Please Enter four grades \n"); scanf("%f", &grade1); scanf("%f", &grade2); scanf("%f", &grade3); scanf("%f", &grade4); Grade = Calculate_Grade(grade1,grade2,grade3,grade4); printf("\n The Average of the Grades %0.2f\n", Grade); /* Convert to celsius*/ printf("\n Please Enter the temperature in Fahrenheit: \n"); scanf("%f", &fahrenheit); // Convert the temperature from f to c formula celsius = (fahrenheit - 32) * 5 / 9; //celsius = 5 *(fahrenheit - 32) / 9; //celsius =(fahrenheit-32) * 0.55556; printf("\n %.2f Fahrenheit = %.2f Celsius \n", fahrenheit, celsius); /* largest number*/ double n1, n2, n3; printf("Enter three different numbers: \n"); scanf("%lf %lf %lf", &n1, &n2, &n3); // if n1 is greater than both n2 and n3, n1 is the largest if (n1 >= n2 && n1 >= n3) printf("%.2f is the largest number. \n", n1); // if n2 is greater than both n1 and n3, n2 is the largest if (n2 >= n1 && n2 >= n3) printf("%.2f is the largest number. \n", n2); // if n3 is greater than both n1 and n2, n3 is the largest if (n3 >= n1 && n3 >= n2) printf("%.2f is the largest number. \n", n3); /* Find Factorial of a Number */ int n, i; unsigned long long fact = 1; printf("\n Enter an integer: "); scanf("%d", &n); if (n < 0) printf("Error! Factorial of a negative number doesn't exist. \n"); else { for (i = 1; i <= n; ++i) { fact *= i; } printf("Factorial of %d = %llu \n", n, fact); } }```