program to print number is even or odd?


Hello friends today C for fun brings you a new program to check whether a number is even or odd it's a basic program but the logic might have not strike you or it depends on the situation that you would not be able to think of the loop for the condition which has to be applied to get the desired output no problem don't worry you would get the algorithm and the logic behind the peach program and steps followed so that you don't face any problem in making a program related to Even and Odd numbers



c4fun brings the basic program which will read the value of N and print  EVEN and ODD after checking, whether they are EVEN or ODD.
even number is exactly divisible by 2. Example: 0, 8, which can be positive or negative
An odd number is not exactly divisible by 2. Example: 1, 7, -11

The steps required to be followed are described step by step and the logic is also explained above the source code is explained below which you can see if you have any doubt but before you go for the source code first check the algorithm and type to make the program by yourself, if still you have some doubt or any question then you should go for the source code but try to find the program by your concept first it always help you to build up your confidence and boost your programming skill

The source code has been written below
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("\n enter number");
scanf("%d",&n);
if(n%2==0)
printf("\n %D is even");
else
printf("\n%d is odd",n);
getch();
}

In a program, the integer is entered by the user which is stored into a variable.
Then, it is checked whether the number is perfectly divisible by 2 or not 
for the checking purpose, we use modulus operator.

When you have done this programming and run the code and executed it as well now you are ready to make your program more attractive and as desired by you.
Try new things in your programming code changes which you should desired off or someone has asked you to in your program.


Share the program among your friends and with whom you think this might help them to build a small program based on small logic C for fun brings you the simple program with a simple logic and help you to understand comma and the basic programming.
C4fun fun is based on sharing is caring method or the idea , as you share it among your friend it's make a change or a link it helps them they help others and so on this process continue.




If you have any doubt question or query you me comment below they would be response in no time but share about experience and the result you have obtained when you make the first program keep learning

Keep coding
Keep sharing
And remember to keep yourself update about the new things coming in the market.....

No comments

thanks for reading and sharing.I hope it would help you!!!!

Powered by Blogger.