Computer Science, asked by somtiwari566, 30 days ago

write a program to print this this pattern.
please reply fast...​

Attachments:

Answers

Answered by ammumisty
1

answer:-

<?php

<?php for($i=0;$i<=5;$i++)

{

{ for($j=1;$j<=$i;$j++)

{

{ echo "* ";

{ echo "* "; }

{ echo "* "; } echo "<br>";

{ echo "* "; } echo "<br>"; }

{ echo "* "; } echo "<br>"; } ?>

output:-

*

* *

* * *

* * * *

* * * * *

if u want to increase this pattern or rows u can change the for statement

Answered by PRahul
1

Answer:

Q1.a

class A

{

 public static void main(String [] args)

  {  int i,j;

    for(i = 1 ; i <=4 ;i++)   //number of rows

    {

       for( j = 1 ; j<=i ; j++)   //number of columns

       {  System.out.print( "*");

       }

      System.out.println( );

    }

 }

}

-------------------(b)

class B

{

 public static void main(String [] args)

  {  int i,j;

    for(i = 1 ; i <=4 ;i++)  

    {

       for( j = 1 ; j<=i ; j++)  

       {  System.out.print( j );

       }

      System.out.println( );

    }

 }

}

Q2.

import java.util.*;

class Table

{

   public static void main(String [] args)

   {

      Scanner sc = new Scanner(System.in);

       System.out.println(" ENTER A NO" );

       int n = sc.nextInt();

       for(int i= 0 ; i<=10 ; i++)

       {

            System.out.println(n+"*"+i+"="+(n*i));

       }

 }

}  

Similar questions