Click the Follow Button

Number pyramid by for loop

 PROGRAM:

#include<stdio.h>

int main ()
{
    for(int i = 1; i <= 5; i++ )
    {
        for (int j = 1; j <= i; j++)
        {
            printf("%d", j);
        }
        printf("\n");
       
    }

    return 0;
}

OUTPUT:

1

12

123

1234

12345

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again