draw a flowchart to calculate the sum of first ten odd number
Answers
Answer:
To calculate sum of consecutive odd number we have a formla as n^2.
Where n is total numbers taken.
For example n is 2 then answer will be 4 i.e 1+3=4 (sum of first two odd numbers).
Sum of first 10 odd number is n^2 i.e is 10^2=100.
Formula derivation
Consider the series
1 , 3,5,7,9,11,,,,,,,,,,,,,,2n-1.
Last number will be 2n-1.
By using A.P WE CAN find sum as n/2 (a+l)
n=total number
a =first term
l=last term
Finally we have n/2 (1+2n-1)
=n/2 (2n)=n^2.
Hope it's helps you army.
Question
draw a flowchart to calculate the sum of first ten odd number?
solution:- ALGORITHM :
Step 1: Start
Step 2: Declare variable c of integer type
Step 3: Set c=0
Step 4: Repeat step 4.1 to 4.3 while (c<=10)
Step 4.1: if (c%2 != 0)
Step 4.2: then print c
Step 4.3 : c=c+1
Step 5: Stop