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
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.
LinkedIn ProfileRelated Posts
Loading related posts…
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
Object Oriented Programming
A complete, exam-ready guide to Object Oriented Programming — covering the core concepts, all five types of inheritance with diagrams,...