This program calculates the sum of the first 5 even numbers by initializing a sum and number variable, then using a while loop to multiply the current number by 2 and add it to the running sum before incrementing number, printing the final sum once the loop finishes.
1 of 1
Download to read offline
More Related Content
Aaaa
1. Sum = 10 + 8 + 6 + + 2 START
Number = 1 sum=0
While
number <=5
Sum = number*2
Number = number +1
Print sum
END