Computer Science, asked by bairavaa6205, 11 months ago

Program to sum of all odd numbers in a given number

Answers

Answered by mahira15
0

Explanation:

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

Answered by Anonymous
2

Explanation:

Sum of all odd numbers = [n(n+1)(2n+1) ]÷6

Similar questions