This a C program that find a number which is even number or odd.
so first we need to know which number is even and which is odd number.the number which is exactly divided by 2 is called even number.
as a example- 2,4,6,8,10 and more which is divided by 2
And the rest of numbers are odd which cannot divided exactly into two pairs.
if you want to divided by 2 its come always as a reminder.
Source Code:
- #include<stdio.h>
- int main()
- {
- int n;
- printf("Enter the number: ");
- scanf("%d",&n);
- if(n%2==0)
- {
- printf("The number is even.");
- }
- else
- {
- printf("The number is odd.");
- }
- return 0;
- }
Outputs:
1. Enter the number: 12
The number is even.
2. Enter the number: 121
The number is odd.
3. Enter the number: 89
The number is odd.
4. Enter the number: 98
The number is even.
0 comments:
Post a Comment