[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Basics

Home > Programs > Basics

8 / 279

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: