Sunday, 5 February 2012

Write a C-Sharp .NET Console program to generate the following number pattern.


Write a C-Sharp .NET Console program to generate the following number pattern.
 1
22
333
4444
55555

Program Code:-

public class  ForLoop{
  public static void main(String[] args){
    for(int i = 1;i <= 5;i++){
      for(int j = 1;j <= i;j++){
        System.out.print(i);
      }
      System.out.println();
    }
  }
}

Output of the program :

1
22
333
4444
55555

No comments:

Post a Comment