Split numbers into digits

Program to split numbers into digits

Split numbers into digits

In this post, we learn to implement in C programming to Split Numbers into Digits. So, without any delay move forward to our program and implement in Turbo C++.

#include<stdio.h>
#include<conio.h>
int main()
{
    int num;
    printf("\n\t\t\t...Welcome To EduNews.Tech... ");

    printf("\n\nEnter a number : \n");
    scanf("%d",&num);
    
    while(num > 0) //do till num greater than  0
    {
        int mod = num % 10;  //split last digit from number
        printf("%d\n",mod); //print the digit. 
    
        num = num / 10;    //divide num by 10. num /= 10 also a valid one 
    }
    printf("\n\n\n\t\t\tThankyou for Joining Us !");
    printf("\n\t\t\t!Regards EduNews !");
return 0;
    getch();
}

Program Output:

split numbers into digits

I hope this post helps you to understand the “Split Numbers into Digits”and its implementation in C programming language.

Keep coding 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *