Write a program to calculate sum of first 10 odd numbers.

This answer is restricted. Please login to view the answer of this question.

Login Now
#include<stdio.h>

int main(){

    int i, sum=0;

    for(int i = 1; i < 20; i = i+2) 
      sum += i;

    printf("sum=%d", sum);

}

The output of above program is

sum=100

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .