Checking a number is Even or Odd

#include<stdio.h>
int main(int argc,char *argv[])
{
    int i;
    if(argc==2)
    {
        if(atoi(argv[1])%2==0)
            printf("\nEVEN NO.\n");
        else
            printf("\nODD NO.\n");
     }
    else if(argc>2) 
        printf("\nEnter only one Integer..!!!\n");
    else 
        printf("\nEnter one Integer.!!!\n");
    return 0;
}

Post a Comment

4 Comments

  1. error: expected declaration or statement at end of input
    return 0;

    ReplyDelete
    Replies
    1. The end curly brace is in black color ,so you may have forgot to write that brace '}' while running the program,that why its showing the error.

      Delete
    2. I have changed the '}' color which was earlier black, due to which it was not visible..otherwise Code is Ok:-)

      Delete