Following program written in java uses continue statement to print a triangular multiplication table for 0 to 9.
//using continue with the label
public class TriangularMultiTable
{
public static void main(String ar[])
{
o:for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
{
if(j>i)
{
System.out.println();
continue o;
}
System.out.print(" "+(i*j));
}
}
System.out.println();
}
}
Output:
//using continue with the label
public class TriangularMultiTable
{
public static void main(String ar[])
{
o:for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
{
if(j>i)
{
System.out.println();
continue o;
}
System.out.print(" "+(i*j));
}
}
System.out.println();
}
}
Output:
Explanation is required plzz
ReplyDelete