Java - while | Sololearn: Learn to code for FREE!

+1

Java - while

How can I use operators in while methad?

9/14/2021 3:36:26 PM

Manasbek Abdugani uulu

16 Answers

New Answer

+3

Manasbek Abdugani uulu while is not a method it's a loop Loops in Java 1 - for - for fix iteration 2 - while - until condition is true 3 - do while - first do then check condition Using these loop we can solve your problem. for (int i = 1; i <= down; i++) { result *= i; } while (down > 0) { result *= down--; } do { result *= down--; } while(down != 0); https://code.sololearn.com/cpMtpshA3D7q/?ref=app

+4

abol forEach is also in Java but in Java 8 Stream API For example: LongStream ls = LongStream.of(1000L, 12000L); ls.forEach(System.out::println);

+2

In the name of kindly generous ALLAH Thanks ALLAH Manasbek Abdugani uulu hello while is a loop is not method! multipaction into 1(factorial in fact) you can do such below: --------------------------java---- int down=5,result=1; while(down>=1){ result*=down--; //or in more simple //result = result * down ; //down = down - 1 ; } ------------------------------------ if was another problem too ,say!

+2

Thank you so much bro Allah bless you 🤲🤲🤲😊 I spent for this loop at least 4 hours and I couldn't find it😁

+2

A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ add to your details in loop in for section that after fix iteration in addition can be enhanced loop(foreach in some other language) so,thank :):):) :) :):):) 1 - for - for fix iteration and enhanced loop

+2

A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ no i meant such it (enhanced loop in java by for loop) ---------------------java---------- int arr[]={1,2,3,4,5}; for(int i : arr) System.out.print(i); ------------------------------------- //output: //12345

+2

+2

+1

Please someone help me

+1

Manasbek Abdugani uulu Which operators?

+1

Thank you to everyone 😊😊😊

+1

Thanks ALLAH thank Manasbek Abdugani uulu too☺☺☺ ☺ ☺☺☺

+1

class WhileDemo { public static void main(String[] args){ int count = 1; while (count < 11) { System.out.println("Count is: " + count); count++; } } }

+1

hi

0

Multiplication

0

I need to multiplicate decrement number in while method