Sunday, 22 October 2017

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;
}

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

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...