+ 2

How will you get the result of this program using while or do while? Just wonna compare my answers. Thank you.

int number = lowerbound; lowerbound = 2; upperbound= 10; int sum = 0; do { sum += number; ++number; } while (number <= upperbound);

9th Sep 2017, 3:34 PM
jomar ibarra
jomar ibarra - avatar
15 Respostas
+ 2
I dont get it do you want other people to do this in different ways or what?
9th Sep 2017, 3:55 PM
Enzo
Enzo - avatar
+ 2
it works its working thank you sorry for disturbing you
9th Sep 2017, 4:11 PM
jomar ibarra
jomar ibarra - avatar
+ 2
it works its working thank you sorry for disturbing you
9th Sep 2017, 4:12 PM
jomar ibarra
jomar ibarra - avatar
+ 2
public class DoWhileLoop { public static void main(String[] args) { int sum =0; int lowerbound = 4; int upperbound = 10; do{ sum+=lowerbound; ++lowerbound; System.out.println (lowerbound); } while (lowerbound <= upperbound); } } here's the code, pls check if its wrong thank you
9th Sep 2017, 4:12 PM
jomar ibarra
jomar ibarra - avatar
+ 2
thank you for your help thank you 👊👊
9th Sep 2017, 4:16 PM
jomar ibarra
jomar ibarra - avatar
+ 1
What if lower bound is 2 and the upperbound is 10
9th Sep 2017, 3:49 PM
jomar ibarra
jomar ibarra - avatar
+ 1
maybe because I'm a little confuse right now really sorry
9th Sep 2017, 3:58 PM
jomar ibarra
jomar ibarra - avatar
+ 1
@Irwin Lopez yes sir
9th Sep 2017, 3:59 PM
jomar ibarra
jomar ibarra - avatar
+ 1
about the post and pre increment and decrement when looping
9th Sep 2017, 4:07 PM
jomar ibarra
jomar ibarra - avatar
+ 1
it works its working thank you sorry for disturbing you
9th Sep 2017, 4:10 PM
jomar ibarra
jomar ibarra - avatar
+ 1
Am I right or wrong 😊
9th Sep 2017, 4:12 PM
Irwin Lopez
Irwin Lopez - avatar
0
Were are the values of lowerbound upperbound Nothing is given
9th Sep 2017, 3:44 PM
Irwin Lopez
Irwin Lopez - avatar
0
Fine
9th Sep 2017, 3:50 PM
Irwin Lopez
Irwin Lopez - avatar
0
Actually @jomar want the output of this code
9th Sep 2017, 3:57 PM
Irwin Lopez
Irwin Lopez - avatar
0
ok if you think that would help you, but you may want to ask about what specific parts do if youre confused.
9th Sep 2017, 4:03 PM
Enzo
Enzo - avatar