This is will show you to compare of all three types of loops (while,do-while and for) and print a triangle pattern.
import java.util.*;
public class star
{
static void sop(String ar)
{
System.out.println(ar);
}
public static void main(String args[])
{
int i,j,k;
Scanner sc=new Scanner(System.in);