Skip to main content

Posts

Showing posts with the label sample c program to print in reverse order

C Program To Print ODD Numbers From 1 To 100.

10) Sample C Program to print ODD numbers from 1 to 100. # include <stdio.h> # include <conio.h> main( ) { int i; clrscr( ); for (i = 1; i <= 100; i += 2) printf("%d\n",i); getch( ); } 11) Sample C Program to print natural numbers from 1 to 100 in reverse order. # include <stdio.h> # include <conio.h> main( ) { int i; clrscr( ); for (i = 100; i >= 1; i --) printf(“%d\n”,i); getch( ); } 12) Sample C Program to print sum of the natural numbers from 1 to 100. # include <stdio.h> # include <conio.h> main( ) { int n, sum = 0, i; clrscr( ); for (i = 1; i <= 100; i ++) sum = sum + i; printf("Sum of natural numbers from 1 to 100 is %d\n",sum); getch( ); }