Ad Code

NEW POST

6/recent/ticker-posts

C program that prints all odd numbers from 1 to 100.

concept: 

we have to print 1 to 100 odd numbers so first, we use a loop from 1 to 100. and then we use the if condition to print the odd numbers 

below is the code


 //write a C program to print all odd numbers from 1 to 100.

#include<stdio.h>

#include<conio.h>

void main()

{

int i;

clrscr();

for(i=1;i<=100;i++)

{

if(i%2!=0)

{

printf("%d,",i);

}

}

getch();

}

Post a Comment

0 Comments