answersLogoWhite

0


Best Answer

Yes

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Shell script to find out the sum of first 10 natural numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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


What command in a script would print on the screen the first variable past to that script?

Well the question is not particularly specific. I assume that we are talking about shell and in this example I would refer to "bash" shell. #!/bin/bash echo $1 this simple script will print first parameter passed to it.


Shell script to find LCM of the given two numbers?

Shell program to find LCM and hcf of two no.s tput clear echo "Enter first no" read a echo "Enter 2nd no" read b p= 'expr $a \* $b' while [$b -ne 0] do r= 'expr $a % $b' a=$b b=$r done LCM = 'expr $p / $a' echo "LCM = $LCM" echo "Hcf = $a"


Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


What is the smallest multiple of the first ten natural numbers?

2520 is the smallest multiple of of first ten natural numbers.


What is the sum of 50 natural numbers?

The sum of the first 50 natural numbers is 1,251.


The variance of first n natural numbers is?

1 Sum of first n natural numbers = n(n+1)2[Formula.]2 Arthmetic mean of first n natural numbers = Sum of the numbers n[Formula.]3 = n(n+1)2n = n+124 So, the Arthmetic mean of first n natural numbers = n+12


How do you refer to the first argument supplied by a user in a shell script?

The first argument is always $1. It may or may not exist, but is always referred to by $1.


What is the product of the first five natural numbers?

Good question. 1+2+3+4+5=155=15 So the product of first five natural numbers is fifteen Natural numbers starts from one So we add first five natural numbers and get the right answer is fifteen


What is sum of natural numbers between 200?

The sum of the first 200 natural numbers is 20,001.


What is the first natural numbers?

123456789101112131415.


Find sum and average of first 10 natural numbers?

The sum of the first 10 natural numbers is 51, with an average of 5.1