C programming code to display the first n odd numbers

Share This Topic:

Course Details

Field of Study: Computer Science and Engineering
Course Name: C Programming
Course Description: C programming code to display the first n odd numbers

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
printf(“Enter the number.\n”);
scanf(“%d”,&n);
for(int i=1;i<=n;i++){
printf(“%d “,(2*i)-1);
}
getch();
}

Share this article:
Previous Post: C programming code to sum numbers from 1 to n

December 2, 2014 - In Academics, Computers

Next Post: C programming code to display the first n even numbers

December 2, 2014 - In Academics, Computers

Related Posts

Leave a Reply

Your email address will not be published.