Write a program to calculate sum of two numbers. Pass the numbers as command line arguments.

C File =>


/* Write a program to calculate sum of two numbers. Pass the numbers as command line arguments. */


#include<stdio.h>
#include<stdlib.h>
int main(int argc,char * argv[]) 

{
   int n=atoi(argv[1]);
   int m=atoi(argv[2]);
   int sum=n+m;
   printf("\n Sum of given numbers = %d",sum);

   return 0;

}

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.