Wednesday, 9 October 2013

Program for Increment Pattern

//Program for Increment Pattern
//Developed by Ahlam Ansari


import java.io.*;
import java.util.*;
class ptrn1
{
    public static void main(String ahlam[])
    {
        int m;
        System.out.println("Enter the number of rows");
        Scanner sc=new Scanner(System.in);
        Scanner n=new Scanner(System.in);
        m=sc.nextInt();
        //n=nextInt();
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<=i;j++)
            {
                System.out.print("*");
            }
            System.out.print("\n");
        }
    }
}


/*
C:\Documents and Settings\AHLAM\My Documents\Google Drive\My Lectures\Fall\OOPM\
Programs>javac ptrn1.java

C:\Documents and Settings\AHLAM\My Documents\Google Drive\My Lectures\Fall\OOPM\
Programs>java ptrn1
Enter the number of rows
4
*
**
***
****

C:\Documents and Settings\AHLAM\My Documents\Google Drive\My Lectures\Fall\OOPM\
Programs>
*/

No comments:

Post a Comment