Number pattern 46 in C

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



Input any number: 22464


Required knowledge

Basic C programming, Loop

Must know - Program to find last digit of a number

Logic to print the given number pattern

Printing these type of patterns are very simple. Logic to print the pattern is very simple, and is described below.

  1. Print the value of num (where num is the number entered by user).
  2. Trim the last digit of num by dividing it from 10 i.e. num = num / 10.
  3. Repeat step 1-3 till the number is not equal to 0.

Program to print the given number pattern

 * C program to print the given number pattern

#include <stdio.h>

int main()
    int num;

    printf("Enter any number: ");
    scanf("%d", &num);

    while(num != 0)
        printf("%d\n", num);
        num = num / 10;

    return 0;


Enter any number: 12345

Happy coding 😉

About Pankaj

Pankaj Prakash is the founder, editor and blogger at Codeforwin. He loves to learn new techs and write programming articles especially for beginners. He works at Vasudhaika Software Sols. as a Software Design Engineer and manages Codeforwin. In short Pankaj is Web developer, Blogger, Learner, Tech and Music lover.

Follow on: Twitter | Google | or

Comments and discussion
Have a doubt, write here. I will help my best.
Before commenting you must escape your source code before commenting. Paste your source code inside
<pre><code> ----Your Source Code---- </code></pre>