I don't specifically know Ruby on Rails, but usually (in most programming languages), to do this task you would define one variable for the sum, and one for a counter. You initialize the sum to zero, and then, in a loop, you (1) increment the counter (most languages specifically have a "for" loop for this), and (2) add the counter to the sum. Here is the pseudocode; it is NOT for a specific programming language, but it gives you the general idea; you should be able to adapt it to most programming languages:
sum = 0
for addend = 1 to 10
{
sum = sum + addend
}
output "Sum = ", sum
Note that you may also need to initialize the variables, depending on the language.
Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.
write a lex program to delete space from the program
How to write a program for mouse in microprocessor?
$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"
To write a C++ program to display the student details using class and array of object.
VBnet program to find the prime numbers between 100 to 200?
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.Just write a method or function that calculates the LCM for two numbers at a time. Then calculate the LCM for the first two numbers, get the LCM of the result with the third number, etc.
All of the whole numbers between one and a billion. Honestly, we're not robots here. Write a program and do it yourself, if you really need them.
int first= 1;
write a lex program to delete space from the program
write an assembly language program to find sum of N numbers
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
fdsgfhgdfhgdf
How to write a program for mouse in microprocessor?
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
please somebody should help me answer this question..I have a project on it even! It seems almost impossible at the moment.