find the sum of odd number till n in c++
Answers
Answered by
1
Answer:
To find sum of odd numbers we must iterate through all odd numbers between 1 to n. Run a loop from 1 to N , increment 1 in each iteration. The loop structure must look similar to for(i=1; i<=N; i++) . Inside the loop add sum to the current value of i i.e. sum = sum + i .
Similar questions
English,
9 days ago
English,
9 days ago
India Languages,
18 days ago
English,
18 days ago
Science,
9 months ago