For example, to calculate GPA, we add all the grade point of a course and divide by the number of courses we are taking. How do I create a program in such a way that when the user enters grade point for two courses, it will add the grade points for the two course and divide by 2. And if another user enters grade points for six courses, it adds the grade points and divides by 6.
Am a beginner, so, please show me an example. Thanks
I guess you will use some kind of loop to read the grade point input from the user. Define a variable before the loop and initialize it to 0. In the loop you increment the variable for each grade point you read. After the loop the variable will contain the total number of grade points that was given.