Hi my name is John,
basically i try to write a program that can print this
2
3
4
5
4
3
2
1
but the i can print from 1 to 5 and i dont know how to go from 4,3,2,1 etc...
/**
* Write a description of class Counting here.
* @author (your name)
* @version (a version number or a date)
*/
public class Counting
{
// instance variables - replace the example below with your own
public int z = 5;
/**
* Constructor for objects of class Counting
*/
public Counting()
{
for (int x = 5; x >=1; x--)
{
for (int y = 1; y<=5; y++)
{
System.out.println(y);
}
System.out.println(x);
}
}
public static void main(String [] args)
{
Counting ncounting = new Counting();
}
}
i am very new to java, a help would be greatful.
thanks in advance
John