QUESTION IMAGE
Question
follow these instructions to complete your assignment:
- 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
- review the output below to check your work.
- 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
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
Flowchart (in Flowgorithm style):
- Start
- Declare
grade1(Integer),grade2(Integer),grade3(Integer),average(Float) - Assign
grade1 = 84,grade2 = 98,grade3 = 73 - Compute
average = (grade1 + grade2 + grade3) / 3 - Output "The average grade is: " +
average - Decision
average > 65?
- Yes: Output "The student passed."
- No: (No action, or optional "The student failed.")
- 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.