0

How do you do this ? Anyone to help?

Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j.

14th Oct 2017, 4:26 PM
Kevin Buma
Kevin Buma - avatar
1 Respuesta
+ 12
Is this what you're lookin' for? int n = 5, j = 0; while(j < n) { System.out.print("*"); j++; }
14th Oct 2017, 4:39 PM
Dev
Dev - avatar