37: W.A.P. to display each of the following patterns

 

37: W.A.P. to display each of the following patterns

 

Please follow me for more practicals....


Program (A):

#include <stdio.h>

#include <conio.h>

 

void main()

{

                clrscr();

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

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

            printf("*");

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (A):

*

**  

*** 

****

  

Please follow me for more practicals....


Algorithm (A):

        1.       START

        2.       Declare i = 1, j = 1.

        3.       Repeat upto step-8 until i <= 4.

        4.       Repeat upto step-6 until j <= i.

        5.       Display *.

        6.       j++.

        7.       Display new line (\n).

        8.       i++.

        9.       STOP.

  

Please follow me for more practicals....


Flowchart (A):



  

Please follow me for more practicals....


Program (B):

#include <stdio.h>

#include <conio.h>

 

void main() {

                clrscr();

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

        for (int j = 4; j >= i; j--) {

            printf("  ");

        }

        for (int k = 1; k <= i; k++) {

            printf("* ");

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (B):

               *

            * *

         * * *

      * * * *

  

Please follow me for more practicals....


Algorithm (B):

        1.       START

        2.       Declare i = 1, j = 4, k = 1.

        3.       Repeat upto step-11 until i <= 4.

        4.       Repeat upto step-6 until j >= i.

        5.       Display Space.

        6.       j--.

        7.       Repeat upto step-9 until k <= i.

        8.       Display *.

        9.       k++.

        10.   Display new line (\n).

        11.   i++.

        12.   STOP.

  

Please follow me for more practicals....


Flowchart (B):


 

 

Please follow me for more practicals....


Program (C):

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

    for (int i = 4; i >= 1; i--) {

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

            printf("* ");

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (C):

 

* * * *

* * *

* *

*

  

Please follow me for more practicals....


Algorithm (C):

        1.       START

        2.       Declare i = 1, j = 5.

        3.       Repeat upto step-8 until i <= 4.

        4.       Repeat upto step-6 until j >= i.

        5.       Display *.

        6.       j--.

        7.       Display new line (\n).

        8.       i++.

        9.       STOP.

  

Please follow me for more practicals....


Flowchart (C):


 

Please follow me for more practicals....


Program (D):

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

    for (int i = 4; i >= 1; i--) {

        for (int j = 4; j >= i; j--) {

            printf("  ");

        }

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

            printf("* ");

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (D):

  * * * *

     * * *

        * *

           *


 

Please follow me for more practicals....



Algorithm (D):

        1.       START

        2.       Declare i = 4, j = 4, k = 1.

        3.       Repeat upto step-11 until i >= 4.

        4.       Repeat upto step-6 until j >= i.

        5.       Display Space.

        6.       j--.

        7.       Repeat upto step-9 until k <= i.

        8.       Display *.

        9.       k++.

        10.   Display new line (\n).

        11.   i--.

        12.   STOP.

  

Please follow me for more practicals....


Flowchart (D):



  

Please follow me for more practicals....


Program (E):

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

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

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

            printf("%d ", j);

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (E):

1

1 2

1 2 3

1 2 3 4


 

Please follow me for more practicals....



Algorithm (E):

        1.       START

        2.       Declare i = 1, j = 1.

        3.       Repeat upto step-8 until i <= 4.

        4.       Repeat upto step-6 until j <= i.

        5.       Display j.

        6.       j++.

        7.       Display new line (\n).

        8.       i++.

        9.       STOP.

  

Please follow me for more practicals....


Flowchart (E):



 

Please follow me for more practicals....



Program (F):

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

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

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

            printf("%d ", i);

        }

        printf("\n");

    }

    getch();

}

  

Please follow me for more practicals....


Output (F):

1

2 2

3 3 3

4 4 4 4

 

  

Please follow me for more practicals....


Algorithm (F):

        1.       START

        2.       Declare i = 1, j = 1.

        3.       Repeat upto step-8 until i <= 4.

        4.       Repeat upto step-6 until j <= i.

        5.       Display i.

        6.       j++.

        7.       Display new line (\n).

        8.       i++.

        9.       STOP.

  

Please follow me for more practicals....


Flowchart (F):

 

Please follow me for more practicals....


 

Please follow me for more practicals....






Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.