print a pattern as shown below



OUESTION:- print a pattern as shown below  

        1  

      2   2  

    3  3   3  

  4  4   4   4  

  

#include <stdio.h>

#include <conio.h>

int main()

{

    int ijkno;

    printf("Enetr a value: ");

    scanf("%d", &no);

    // rows

    for (i = 1i <= noi++)

    {

        // space

        for (j = noj >= ij--)

        {

            printf(" ");
        }

        // display

        for (k = 1k <= ik++)

        {

            printf("%d "i);
        }

        printf("\n");
    }

    return 0;

    getch();
}

Note:- you can make changes to all the patterns according to your wants and need. 


OUTPUT

Enetr a value: 5

     1 

    2 2

   3 3 3

  4 4 4 4

 5 5 5 5 5


Follow our page for regular updates.

0 Comments