answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<process.h>

#include<stdlib.h>

void main(int argc, char *argv[])

{

int i,result=0;

if(argc<3)

{

puts("Enter atleast two numbers!!");

exit(1);

}

else

{

for(i=0;i<argc;i++)

result+=atoi(argv[i]);

}

printf("Result is %d",result);

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write c program using command line arguments for adding two numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How is adding fractions like adding whole numbers?

adding fractions is like adding a WHOLE lot of parts of numbers


What is the rule in adding rational numbers?

what is the rule in adding rational numbers


How is adding mixed numbers different from adding fractions?

when you add mixed numbers you have a whole number but adding fraction does not.


What do you call the result of adding of to numbers?

The result of adding two numbers is their sum.


How is adding mixed numbers the same as adding fractions?

Mixed numbers can be converted to improper fractions. Then, it is exactly the same as adding proper ones.


What do you call the result adding two numbers?

Adding two or more numbers together gives you a sum.


What is the term used for adding 3 numbers together?

adding.


What exactly is a Checkbook Balancer?

A checkbook balancer could be a person doing simple adding and subtracting of the numbers in their checkbook account. It is also a software program or a device.


Which average is found by adding the numbers then dividing by how many there are?

The mean of a set of numbers is found by adding them together and dividing by how many numbers were added.


How is adding integers similar to adding whole numbers?

Integers include 0, the negative numbers without fractional parts, and the positive numbers without fractional parts. The "without fractional parts" part of the description implies that all of the integers are whole numbers. Therefore, if you are adding integers, you are adding whole numbers.


Unix program for adding of two numbers?

$vi sum.sh echo "enter the 1st no." read num1 echo "enter the 2nd no." read num2 sum= 'expr $num1 + $num2' echo "sum of the numbers is $sum"


What is the symbol for adding two numbers together?

+ is the symbol for adding two numbers together.It is usually called the plus symbol.