Activity 2.7.1. Activity Coding Exercise.
Save and Run the below program.
Answer.
To find sum and average of three numbers
Learning Objective:
|
Integer Class1, Class2, Class3
Integer average
Integer sum
Display “Enter the number of students in class 1”
Class1 = Input
Display “Enter the number of students in class 2”
Class2 = Input
Display “Enter the number of students in class 3”
Class3 = Input
Sum = Class1 + Class2 + Class3
Average = sum/3
Display “The sum is “, sum, “ and the average is ”, average
Enter the number of students in class 1 |
→ input: 15 |
Enter the number of students in class 2 |
→ input: 20 |
Enter the number of students in class 3 |
→ input: 19 |
The sum is 54 and the average is 18 |