Friday, 21 July 2017

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

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

Write a C program to print all even numbers from 1 to n the usage of for loop. C software to generate all even numbers among given range. How to display even numbers between 1 to n the usage of for loop in C programming. Logic to print even variety the usage of if else and for loop in given range in C application.

Code:


#include<stdio.h>
#include<conio.h>
void main()
{
 int a,n;
 printf("Enter The Range\n");
 scanf("%d",&n);
 printf("Even Numbers In This Range\n");
 for(a=2;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