Check my program....i want a decrement of 10 for the value of K, how can i do this ?
public class arrey
{
public static void main (String [] args)
{
int i, j, k = 100;
int [][] TwoDArray;
TwoDArray = new int [4][];
TwoDArray [0] = new int [1];
TwoDArray [1] = new int [2];
TwoDArray [2] = new int [3];
TwoDArray [3] = new int [4];
for ( i=0; i<TwoDArray.length; i++ )
{
for ( j=0; j<=i; j++ )
TwoDArray [i][j] = --k;
}
for ( i=0; i<TwoDArray.length; i++ )
{
for ( j=0; j<=i; j++ )
System.out.print (TwoDArray [i][j] + " ");
System.out.println ("");
}
}
}
i replaced --k
with k=k-10
and it works , but this is not a proper way to decrement and the first value become '90'
i want decrement of 10 starting from 100 to 0