//A C program to print ODD numbers from 1 to N using while loop.
#include<stdio.h>#include<conio.h>
void main()
{
int number=1,n;
printf("Enter the value of N: ");
scanf("%d",&n);
while(number<=n)
{
if(number%2 != 0)
printf("%d ",number);
number++;
}
getch();
}
Output:
Nhận xét
Đăng nhận xét