answersLogoWhite

0


Best Answer
Copy

Example in Java:

int total = 0;

int i = 1

while (i <= 10)

{

total += i;

i++;

}

System.out.println("The sum of the first ten numbers is " + total);

User Avatar

Wiki User

โˆ™ 2010-05-30 12:44:28
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Add your answer:

Earn +5 pts
Q: What is 1 plus 2 plus 3 plus 4 plus 5 plus 6 plus 7 plus 8 plus 9 plus 10 equals 55 how is it possible using while loop?
Write your answer...
Submit

Related Questions

How do you rewrite a for loop into a while loop?

Your question is to open. While loops are used when something equals something such as While x=80 but a for loop will continually go on until the loop finishes. So their is no possible way to convert a while to a for loop.


How a C program to find LCM using while loop?

how to find the lcm using while loop


Is it possible to use a for loop in place of a while loop?

Yes. while loop consist of only condition statement to make for loop look as while loop we can use syntax shown below: for(;condition;) eg: for(;i&lt;=n;)


What is the advantages of using for loop than while loop?

when there is a need to do initialisation,condition check and increment in the same statement then for loop is used.otherwise while loop is used.


What is the main difference between a while loop and a do while loop?

In most computer programming languages using these constructs:while loop, the condition is tested beforeentering the loop (loop may be skipped completely)do while loop, the condition is tested aftercompleting the loop (loop will execute at least once)


How do you write an infinite loop using the while loop?

while (1) puts ("press Ctrl+C");


How do you write a program with do while loop so that the output is 123456 equals 720?

How do you write a program with do while loop so that the output is 123456 =720


Is possible to use a for loop in place of a while loop?

Yes, it's easy:Old: while (expression)statementNew: for (; expression;)statement


How do you program using do-while loop in java?

dutkdtukuk


Reverse of the number using only while loop?

apple


Comparison between for loop and do-while loop?

A for loop is typically used whenever a sequence needs to be performed a pre-determined number of times using a counter variable and a conditional expression. It is quite similar to a while loop except a while loop only has a conditional expression and is typically used for infinite loops. A do-while loop is similar to a while loop except that the conditional expression is evaluated at the end of the loop rather than at the beginning. Thus a do-while loop is guaranteed to execute at least once, whereas a for or while loop may not execute at all.


What is the difference in while loop and do while loop?

The condition for a while loop is tested at the start of the loop. It is tested at the end of the loop for a do-while loop. The body of a do-while loop will always be executed at least once. Whereas for a while loop if the condition is false to start with, the body of the loop is never executed.


What are the similarities of while loop and a do while loop?

They both loop


What is the differences between while loop and do while loop?

The while loop tests the condition at the top, while the do while loop tests the condition at the bottom. If the condition is initially false, the while loop will never execute, while the do while loop will execute once.


What is the difference between do while and while loop in java?

do ... while will evaluate the condition at the end of the loop.while... will evaluate the condition at the beginning of the loop.do ... while will evaluate the condition at the end of the loop.while... will evaluate the condition at the beginning of the loop.do ... while will evaluate the condition at the end of the loop.while... will evaluate the condition at the beginning of the loop.do ... while will evaluate the condition at the end of the loop.while... will evaluate the condition at the beginning of the loop.


What is a repeat until loop?

In C and C++, a repeat until loop is created using a do-while loop structure. A do-while loop executes at least once and terminates when the while condition evaluates false, re-iterating the loop if the evaluation is true. This is in contrast to for and while loops which evaluate the condition at the start of each iteration, and may not execute at all. Which loop structure you use is determined by the type of loop. If you need to count the iterations with a control variable and/or perform one or more actions at the end of each loop then a for loop is generally best. If the loop is simply conditional then a while loop is best. And if the loop must execute at least once, then a do-while loop is best.


What is the difference between while loop and for loop in c computer language?

For while loop you have to define conditions for the loop in loop's body. In, "for loop" case it's more natural and comportable. For loop is good for numeric simulations in other words when you are using only numbers. Loop while is very good for symbolic conditions, for instance, to check the condition that char1 == char2;


How do you get the ouput as 11111 using while loop?

int i = 0; while( (i++) &lt; 5 ) { printf("1"); }


What is a C programming to calculate the sum of 1-2-3-4-5 and so on using while loop a for loop and a do while loop?

#include using std::cout;using std::endl;int main(){int number(1);cout number;//using loop forint sum(0);for(int i(1); i


When should use a while loop over a do loop?

Use a while loop when you need to test the controlling conditional expression before each iteration begins. Use a do loop when you need to test the controlling conditional expression after each iteration. The main difference between the two types of loop is that a do loop always performs at least one iteration whereas the while loop may not iterate at all. Whenever possible, prefer a while loop to a do loop because a while loop has the conditional expression up front where it is easily seen and therefore makes your code that much easier to read.


How do you do a nested loop using Qbasic?

There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.


How do you convert a while loop to do-while loop?

While loop: while (condition) { do some stuff } Do while loop: do { some stuff } while (condition) (This answer has nothing to do with the question.)


What kind of loops are used in C?

For loop, while loop, do while loop and goto loop.


How can you define null statement in loop in C programming?

If you are using for loop for(;;); or you can also define condition and iterations but the loop has to close there itself without any statement inside it. In the similar way you can define while and do while loop without any statement.


What type of loop repeats until the condition becomes false?

A for-loop, a while-loop, and a do-while-loop.