Wednesday, September 11, 2013

Java Program 006

Write a Java Program to print This Pattern.

1
2 4
3 6 9
4 8 12 16
5 10 15 20 25

  1: public class DisplayPattern10
  2: {
  3: 	public static void main(String[] args)
  4: 	{
  5: 		int endValue = Integer.parseInt(args[0]);
  6: 		
  7: 		for(int i = 1; i <= endValue; i ++)
  8: 		{
  9: 			for(int j = i; j <= (i * i); j = j + i)
 10: 			System.out.print(j + " ");
 11: 
 12: 		System.out.println("");
 13: 		}
 14: 	}
 15: }