Using a do while loop write a java program that will display the sum of even numbers from 1-20 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Using a do while loop write a java program that will display the sum of even numbers from 1-20

Java program

10th Mar 2020, 6:31 AM
Greyci Carnienie
Greyci Carnienie - avatar
4 Antworten
+ 9
please show what u did so far.
10th Mar 2020, 6:36 AM
Oma Falk
Oma Falk - avatar
+ 7
Hello Your question appears to be homework. Please add your code attempt when asking for help so the community can help you. Here are the 8 rules for getting help. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community Thank you
10th Mar 2020, 6:36 AM
BroFar
BroFar - avatar
0
Assign x=0, before start of loop, sum=sum+x; //for adding values x=x+2; //will give you next even number Repeat this in loop until x<=20, Then output result.. Edit: Good try.. Can you remove dublicate question pls?
10th Mar 2020, 7:22 AM
Jayakrishna 🇮🇳
- 3
public class program public static void main( strings [] args) { do { int x=0; While(x<=20)
10th Mar 2020, 6:48 AM
Greyci Carnienie
Greyci Carnienie - avatar