Program for the addition of two numbers

Check the given number is ODD or EVEN.



The number is even only if number divided by 2 and the remainder is 0.

#include<stido.h>
#include<conio.h>

main()
{
            int  num;
            printf(" Enter any number :- ");
            scanf("%d",&num);
           
            if(num%2==0)
            {
                    printf(" The given number is Even");
            }
            
            else
             {
                     printf("The given number is Odd");
              }

             getch();
}

Output: 
   1)    Enter any number :- 8
          The given number is Even

   2)   Ener any number:- 5
         The given number is Odd

Explanation:

Note: % is a mod operator which return the remainder of the    
           division operator

    1)Suppose the number is 8 then,
        8 divide by 2 then remainder = 0, So the number is Even
   
     
     2) The number is 5 then,
        5 divide by 2 then remainder = 1, The number is Odd



    For more program and notes please follow the link


You can see

Program to check the given number is positive or negative

program for sum of digit
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Important of Database privilages

Database privileges Privileges are the right or permission to execute particular SQL statements.                           System Se...