Write a program to find the sum of the first 10 odd numbers.

 #include <stdio.h>

 #include<conio.h> 

void main() {

    int  i, sum = 0;

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

    {

            printf(“%d \n”,i);

             sum =sum+ i;

    }

    printf("Sum of first ten odd numbers= %d", sum);

   getch( );

}

 

Netra Koirala

Netra Koirala

Computer Science Educator

Passionate computer science educator and author. Provides free study notes, practical guides, and tutorials for Class 9, 10, 11, 12, and B.Sc CSIT students in Nepal. Years of teaching experience in computer science fundamentals.

Computer Science notes, tutorials, MCQs, and educational resources for Nepal students. Covering Class 9, SEE preparation, Class 11, Class 12, SLC, programming, DBMS, networking, HTML, JavaScript, PHP, OOP and more.

Featured Post

Grade 10 Computer Science: Specification Grid & Model Questions

Specification Grid & Model Questions of Computer Science | Grade 10 📚 Examination Resource Specification Grid & M...

Followers