Loop While

Counter-Controlled Repetition Examples

  1. Write a program that reads grades for 5 students in the class and finds the average grade.

  2. Write a program that first reads the number of students in the class, then reads the grade for each student. The program finds the average grade in the class.

  3. Write a program that first reads the number of students in the class, then reads the grade for each student. The program counts the number of students who got A (grade 95 and above).

  4. Write a program that first reads the number of students in the class, then reads the grade for each student. The program finds the average passing grade (grade 60 and above).

  5. Write a program that first reads the number of items the person bought the store and the tax. The program then reads the price for each item. The program finds the total amount paid after tax applied.

  6. Write a program that first reads the number of items the person bought the store. The program then reads the price for each item. The program finds the number of items that cost 10 dollars and above.

  7. Write a program that reads 10-digit integer, and finds and prints the average of its EVEN digits. If there are no even digits in the input, the program prints an appropriate message.