Submitted Questions

  • printing numbers in spiral shape

    I need an algorithm for some program. I'll take some number (say 'n'), then i should print the numbers in spiral shape starting from square(n). Can any one pls help me..Ex: if n=3, it should print like9 8 72 1 63 4 5Thanks in advance

    datdo

    • Jan 29th, 2009

    //spiral//by datdo//translated C codepublic class Spiral {int n =3;public static int SPIRALHEIGHT =  n;public static int SPIRALWIDTH = n;public static main(String[] args) {    int ...

    Gerda

    • May 8th, 2008

    One of possible solutions:public class NumberSpiralShape { /*** @param args*/public static void main(String[] args) { // TODO Auto-generated method stub int n = 3, i, side = n, x=0, y=0;int tab [...