Follow This Blog For more... 😊

Program to print triangle(◣) Pattern:1 | Using C language| C Program series 22|

👨‍💻Program to print triangle() Pattern:1.

Code 1 :

For FIXED LINENS:


    /*
    Pattern 1

    *
    **
    ***
    ****
    *****

    */
    #include<stdio.h>
    main()
    {
        printf("Pattern\n\n");
       
        int i,j;
        //i for row
        //j for column
       
        for(i=1;i<=5;i++)
        {
            for(j=1;j<=i;j++)
            {
                printf("*");
            }
            printf("\n");
        }
    }

The Output of code 1:


👨‍💻Program to print triangle() Pattern:1 for n number of lines.

Code 2 :

For n number of LINENS:

   
    /*
    Program to print triangle Pattern:1 for n number of lines.
    For Example:n=10
    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
    **********
    */
    #include<stdio.h>
    main()
    {
        printf("Program to print triangle Pattern:1 for n number of lines.\n\n");
       
        int i,j,n;
        //n for number
        //i for row
        //j for column
       
        printf("Enter the number:");
        scanf("%d",&n);
       
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=i;j++)
            {
                printf("*");
            }
            printf("\n");
        }
    }

The output of Code 2:




👉Click for more C Program series Questions.[Questions list]

Comments

Popular Posts