0
While in java
Why Only 1 test passed out of 4 public int whileExample (int end){ int sum = 0; int i = 0; while (i < 6){ sum = sum + i; i = i + 1; } return sum; }
7 Answers
+ 2
What is the your task here?
Share total code with full description..
+ 2
Don't share your code in description and attach the relevant programming tag also
+ 2
Yes. It will return 15
But what does the passing parameter 'end' do there? May be you are taking count 0 to 6 , but i think you need to take care about 'end' value. Read description carefully again
+ 1
I need to find sum of numbers 0 to 6 (6 excluded). Answer should be 15.
+ 1
i <end , end is 6
+ 1
Thank you, I got it.
+ 1
You're welcome..