Find Even Numbers using C Program

This program helps to Find Even Numbers using C Program . This is the simple C language Program to find the even numbers in a given range. User can give any number in the variable but it executes and prints even numbers.

How the code works?

  1. #include<stdio.h> – The C programming language provides many standard library functions for file input and output. stdio means standard input output library.
  2. #include<conio.h> – The conio.h used to display the result.
  3. main() – The c programming starts with main function. The main functions opening brace indicates start of the program and closing brace indicates end of the program.
  4. int n; – This is the integer variable declared to initialize the value.
  5. n=10; – n value initialized to 10
  6. int i=2; – i value initialised to 2
  7. while(i<=n) – while loop created to check the record. if i is less than n then the condition executes else the loop condition becomes false.
  8. if((i%2)==0) – This condition check whether the reminder of division is available or not. If the reminder is available in this condition then the condition becomes false. The logic is reminder of division displays only for odd numbers. If it is even number then the condition becomes true.
  9. printf(“%d”,i); – printf statement to print the record. here it prints the value of i. Each time the condition loops the i value increases.
  10. i++ means it increases its value. i value increases until the condition becomes false. When the condition becomes false then the system displays the result of even numbers.
  11. getch(); – this is the function which diplays output.

Find Even Numbers using C Program

/*Coding to find and display the even number*/
#include <stdio.h>
#include <conio.h>
int n;
n=10;/*For Given Number*/
int i=2;
Note: This program is created in turboc. User must install turboc to check the output. If you have any doubts or any comments kindly post in the comment box.
For C programming student projects kindly visit the following link – Click here>>


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.