C program to print even numbers between given two numbers.

This blog has been migrated to learn c programming for beginners


Write a C program print even numbers between given two numbers.

This C program prints the even number between the two number supplied by user

C Program source code

#include<stdio.h>
#include<conio.h>
int main()
{
 int i,n1,n2;
 printf("Enter any two numbers:\n");
 scanf("%d%d",&n1,&n2);
 for(i=n1;i<=n2;i++)
 {
  if(i%2==0)
  {
   printf("%d\t",i);
  }
 }
 printf("\nThese are the even numbers between those two numbers.");
 getch();
 return(0);
}

You can Browse related article below for more information and program code related to different math operation.  Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required



C program to print even numbers between given two numbers.

Comments

Popular posts from this blog

Copy Constructor

Print pattern in c - explore new perspectives in pattern printing

C program to check if the supplied year is leap year or not.