Wednesday, 30 August 2017

Number Pattern - 1

Write a C program to print the given number pattern using loop. How to print the given triangular number pattern using for loop in C programming. Logic to print the given number pattern using loop in C program.

12345
1234
123
12
1


#include <stdio.h>

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

    return 0;
}

No comments:

Post a Comment