Last active
April 4, 2019 19:12
-
-
Save anonur/6428c7694c3c7ca6ea181d3fb9520c0d to your computer and use it in GitHub Desktop.
Finds note average of 10 students
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| int main(void) | |
| { | |
| unsigned int counter; | |
| int grade; | |
| int total; | |
| int average; | |
| //initialization phase | |
| total = 0; //initialize total | |
| counter = 1; //initialize loop counter | |
| //processing phase | |
| while(counter <= 10) { | |
| printf("%s","Enter grade: "); //prompt for input | |
| scanf("%d",&grade); //read grade | |
| total = total + grade; //add grade to total | |
| counter = counter + 1; //increment counter | |
| }//end while | |
| //termination phase | |
| average = total / 10; //integer division | |
| printf("Class average is %d\n",average); //display result | |
| } //end function main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment