Friday, 21 July 2017

Print the sequence of all Odd numbers within the range input by user

Print the sequence of all Odd numbers within the range input by user.

Write a C program to print all odd numbers within the range input by user using for loop. The way to show unusual numbers from 1 to n the usage of loop in C programming. C application to print atypical numbers in a given range. Logic to print extraordinary numbers in a given range.

Code:

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,n;
 printf("Enter The Range\n");
 scanf("%d",&n);
 printf("Odd Numbers In This Range\n");
 for(a=1;a<=n;a+=2)
  {
  printf("%d\n",a);
  }
 getch();
 clrscr();
}

Output:


Try it yourself.
If you have any problem you can tell me on comment box i will help you.
thanks.

Viral Programs

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment