C Program: Enter a Number and Determine It Is Even or Odd Number

C program image

This program is based on conditional statement that is if-else.
Write a Program: Enter a Number and Determine wheather it is Even or Odd Number.

#include<stdio.h>                          
// Header file contain input output functions.
#include<conio.h>                         
// Header file contain clrscr() and getch() functions.
void main()                                   
// C program execution start with this main function. No C program can execute without this main function.
{
int a,b;                                         
// Declare two variables a and b of integer data type.
clrscr();                                       
// Clear the result of previous output.
 
printf(" Enter the value of a");     
// This is output function. Enter the value of a is show on screen.
scanf("%d", &a);                     
// This is input fuction. We enter the value of variable a with the help of scanf function.
b=a%2;                                   
// The remainder value obtained after dividing integer variable a by 2 is assign to integer variable b.
if(b==0) 
// if-else condition is applied
{
printf("Number is Even");
}
else
{
printf("Number is Odd");
}
getch();
}
// If the condition b==0 is True then Number is Even execute other wise Number is Odd is executed. 

NOTE: The Lines written in // symbol is for just telling about the meaning of statement. These lines not executed in the program.
Output1:

Output1:
Enter the value of a           
44
Number is Even

Output2:
Enter the value of a              // clrscr() clears the previous output1
77
Number is Odd

0 Response to "C Program: Enter a Number and Determine It Is Even or Odd Number"

Post a Comment

Popular Posts

Label

1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag