Take FREE!! Online AMCAT Mock Test to Crack Wipro NLTH, Capgemini, etc.
Get Off-Campus Placement Jobs Info !!!
Practice Given Here Wipro NLTH Practice Q&A

Program Discussion :: Basics

Home > Programs > Basics

311 / 259

Write a program using command line argument to input two number and Calculate the Sum of numbers.

Answer:

#include 
#include 

int main(int argc, char * argv[])
{
  int x,y;
  if (argc == 1 || argc > 3)
  {
    printf("Enter Two Number\r\n");
    exit(0);
  }
  x=atoi(argv[1]);
  y=atoi(argv[2]);
  printf("\nSum of two number %d and %d is : %d\r\n",x,y,x+y) ;
return 0;
}

Asked In :: TCS

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: