Here is a simple program that I wrote using C language to ask the user to give a number and then our program will check and determine if the given number is odd or even. I am using CodeBlocks as my text editor and Dev C++ as my C compiler which is freely available to download over the Internet. I hope you like my work. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
#include <stdio.h>
int main()
{
int val=0;
printf("Odd and Even Number Checker in C");
printf("\n\n");
printf("Enter a number : ");
scanf("%d", &val);
if(val % 2 == 0) {
printf("\n\n");
printf("The given number %d is an EVEN number.",val);
}
else {
printf("\n\n");
printf("The given number %d is an ODD number.",val);
}
printf("\n\n");
printf("End of Program");
printf("\n\n");
}
No comments:
Post a Comment