Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

follow these instructions to complete your assignment: 1. write a flowc…

Question

follow these instructions to complete your assignment:

  1. write a flowchart and c code for a program that does the following:
  • declare variables with integer or float datatypes.
  • assign the values of three grades (84, 98, 73) to each of the variables
  • compute the average of the grades – keep the order of operations in mind
  • display the average using an appropriate message
  • add a decision that checks to see if the average grade is greater than 65, if true display a message that the student passed.
  • be sure to add comments throughout your program describing what is happening
  1. review the output below to check your work.
  2. paste the following three items into a word document (.docx):

a. your flowchart in flowgorithm
b. a screenshot of your code
c. a screenshot of your output (including the title bar showing

Explanation:

Answer:

Flowchart (in Flowgorithm style):
  1. Start
  2. Declare grade1 (Integer), grade2 (Integer), grade3 (Integer), average (Float)
  3. Assign grade1 = 84, grade2 = 98, grade3 = 73
  4. Compute average = (grade1 + grade2 + grade3) / 3
  5. Output "The average grade is: " + average
  6. Decision average > 65?
  • Yes: Output "The student passed."
  • No: (No action, or optional "The student failed.")
  1. End
C Code:
#include <stdio.h>

int main() {
    // Declare variables for grades (integers) and average (float)
    int grade1, grade2, grade3;
    float average;

    // Assign values to the grade variables
    grade1 = 84;
    grade2 = 98;
    grade3 = 73;

    // Calculate the average of the three grades
    average = (grade1 + grade2 + grade3) / 3.0;  // Use 3.0 for floating-point division

    // Display the average grade
    printf("The average grade is: %.2f
", average);  // %.2f for 2 decimal places

    // Check if average is greater than 65 to determine pass/fail
    if (average > 65) {
        printf("The student passed.
");
    }

    return 0;
}
Output (when running the code):
The average grade is: 85.00
The student passed.

To complete the assignment:

  • Create the flowchart in Flowgorithm (or similar) using the steps above.
  • Take a screenshot of the C code (as written above).
  • Run the code, take a screenshot of the output (including the terminal/console title bar), and paste all three items (flowchart, code screenshot, output screenshot) into a Word document.