hi to all..
i would like to ask if this algorithm is accepted or is it a cheat? thanks
here's my code
import java.util.*; public class loop1 { public static void main (String[]args) { int x,y,limit; Scanner input = new Scanner (System.in); System.out.print("enter a limit: "); limit = input.nextInt(); for(x=1;x<=limit;x++) { for(y=x;y<=limit;y++) { System.out.print(" "+y); } System.out.println(); } for(x=limit-1;x>=1;x--) { for(y=x;y<=limit;y++) { System.out.print(" "+y); } System.out.println(); } } }
and the output should be like this
*****
****
***
**
*
**
***
****
*****