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:
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n;
  5. printf("Enter the number: ");
  6. scanf("%d",&n);
  7. if(n%2==0)
  8. {
  9. printf("The number is even.");
  10. }
  11. else
  12. {
  13. printf("The number is odd.");
  14. }
  15. return 0;
  16. }
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