write an algorithm to find the sum and average of 2 numbers in C programming language.
Answers
Answered by
2
Algorithm : →
Step 1 : Start
Step 2 : sum = 0, i = 1, average, count = 0
Step 3 : if i / 2 == 0 then go to step 4, else go to on step 5
Step 4 : sum = sum + i, count = count + 1
Step 5 : i = i + 1
Step 6 : if i <= 50 then go to on step 3, else go to on step 7
Step 7 : Display “sum”
Step 8 : average = sum/count
Step 9 : Display “average”
Step 10 : Stop
—————————————————————————————————————
Alternative : →
Step 1 : Start
Step 2 : sum = 0, i = 0, average, count = 0
Step 3 : i = i + 2
Step 4 : sum = sum + i, count = count + 1
Step 5 : if i <= 50 then go to on step 3, else go to on step 6
Step 6 : Display “sum”
Step 7 : average =sum/count
Step 8 : Display “average”
Step 9 : Stop
Similar questions
World Languages,
2 months ago
Political Science,
2 months ago
English,
4 months ago
Chemistry,
4 months ago
Math,
9 months ago
Math,
9 months ago
Math,
9 months ago