answersLogoWhite

0


Best Answer

2 4 6

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Sum of n numbers in shell programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Find the programming code for calculating the sum of the squares of the first 1000 numbers in HASKELL?

To get a list of the squares of the first 1000 numbers we can do:> [n^2 | n sum [n^2 | n


How do you get the sum of consecutive cubed numbers?

The sum of the first n cubed numbers is: [n*(n+1)/2]2 which is the same as the square of the sum of the first n numbers.


How do you find the average of n numbers?

The average of n numbers = (sum of n numbers) / (count of n numbers).


What is the c plus plus program for printing sum to n natural numbers?

main() { int i, n, sum=0; cout<<"Enter the limit"; cin>>n; for(i=0;i<=n;i++) sum=sum+i; cout<<"sum of "<<n<<" natural numbers ="<<sum; getch(); }


In Shell script. How do I ask for and accept two numbers and then calculate the sum of the supplied numbers and display the sum.?

It depends on the script language you are using. In the Korn shell, you can say: echo -n "Enter the first number: " read first echo -n "Enter the second number: " read second let third=$first+$second echo The answer is $third


How do you sum numbers in a Unix shell script?

try a for loop: for x in 1 2 3 4 n=0 do n=`echo $x+$n`|bc done Integer arithmetic can be done in the shell itself without requiring an external program, making the operation much faster: n1=123 n2=543 sum=$(( $n1 + $n2 )) echo "$sum"


Find the mean of n natural numbers?

Mean = (sum of the n numbers)/n


How do you calculate the sum of all numbers from 1 through 61?

The sum of the first "n" numbers is equal to n(n+1)/2.


What 2 numbers sum is 832?

i need 2 numbers whose sum is 832AnswerThe numbers are n and (832 - n) where n is any number from 0 to 416.


What is formula to find sum of n even numbers?

There is no formula that will sum n even numbers without further qualifications: for example, n even numbers in a sequence.


Write a shell program that Adds the integers 1 to 100 and dislay a message?

SUM = 0: FOR N = 1 to 100: SUM = SUM + N: Next N: PRINT CHR$(11); "Sum ="; SUM: END


What is the Sum of first n natural numbers?

int sum = 0; int i; for(i = 0; i < n; ++i) { sum += i; }