Take five numbers as input from the user using only 1 variable, calculate and display their sum, average and sum of even numbers. (without using loop)
write algorithm
Answers
Answered by
0
Answer:
The algorithm to calculate sum, average and sum of even numbers is as follow:-
- Step-> Start
- Step-> Declare five integer variables (a,b,c,d,e) type integer.
- Step-> Take input of five numbers.
- Step-> Add all variables and print the sum. Print (a+b+c+d+e)
- Step-> Calculate the average and print the result. Print ((a+b+c+d+e)/5)
- Step-> Check the number is even or odd, if even calculate the sum in another variable, and print the result.
- Step-> Stop
Explanation:
Here in the algorithm there are total three calculations, the longest calculation is done in the calculation of the sum of digits.
Similar questions