Thursday, 10 July 2014

Program for Right Triangle in Java

This is the program for Triangle and on place of "*" you can use any other variable as you want to print.

public class Triangle
{
    public static void main(String Args[])  
    {
    int i,j;
    for(i=0;i<10;i++)
 
    {
        System.out.println(" * ");
        for (j=0;j<=i;j++)
        {
            System.out.print(" * ");
       }}

    }
}

No comments:

Post a Comment