C Programs World
Learn C programming basics to high level online.
Networking MCQ's
Home
Aptitude
Learn C
Programs
Networks & Java MCQ's
Sorting Algorithms
Data Structures
Zoho Interview Questions
Ruby on Rails
Tuesday, 5 September 2017
C-Program to print all the odd number till ‘N’
PROGRAM :
O
dd number till ‘N’
#include<stdio.h>
int main()
{
int i,n;
printf("Enter a Number to print all odd number between 0 and N \n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
if(i%2==1)
//To Check given odd or not
printf("%d\n",i);
}
return 0;
}
Input : 15
Output : 1 3 5 7 9 11 13 15
OUTPUT :
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment