To study the parity of a number it is enough to check whether or not it is a multiple of the number 2.
Even numbers are the numbers that end with
{0, 2, 4, 6, 8, 10, 12, …, n * 2} = {2n; n is a natural or relative integer}.
Odd numbers are the numbers that end with
1, 3, 5, 7, 9, 11, 13, …, n * 2 + 1 = {2n + 1; n is a natural or relative integer}.
An even number is any number whose remainder of the division over 2 is equal to 0. It is also said that they are multiples of 2.
An odd number is any number whose remainder of the division out of 2 is equal to 1.
Even numbers are divided in two equal parts:
3 + 3 = 6
4 + 4 = 8
7 + 7 = 14
Odd numbers are not shared in two equal parts:
3 = 1 + 2
7 = 3 + 4
41 = 40 + 1
The square of even numbers is an example:
0² = 0
2² = 4
4² = 16
6² = 36
The odd number square is odd, for example:
1² = 1
3² = 9
5² = 25
7² = 49
Note:
Every prime number is an odd number except the number 2.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<stdio.h> #include<stdlib.h> main() { int num; printf("Enter an integer: "); scanf("%d", &num); if(num%2==0) printf("%d is an even number\n",num); else printf("%d is not an even number\n",num); system("pause"); } |