Back To C++ Loops Index
//program to find sum of odd numbers from 1 to 10 using for statement #include
#include
void main() { int i; int sumodd=0; clrscr(); for(i=1;i<=10;i++) { if(i%2!=0) { sumodd=sumodd+i; } } printf("sum of odd numbers from 1 to 10 is %d",sumodd); getch(); }