Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed how to seperate a number into digits using c programming?

+1 vote
asked May 30, 2019 by kyunsoo H
closed Jun 15, 2019 by Admin
closed with the note: Closing question since already solved.

5 Answers

0 votes
answered Jun 1, 2019 by Raghul K S A
#include<stdio.h>

int main()

{

int num;

scanf("%d",&num);

while(num>0)

{

num=num/10;

printf("%d",num);

}

}
0 votes
answered Jun 2, 2019 by Jack sparrow (220 points)
#include<stdio.h>

int main()

{

int a,rem;

scanf("%d",&a);

while(a!=0)

{

rem=a%10;

printf("%d ",rem);

a=a/10;

}

return 0;

}
0 votes
answered Jun 2, 2019 by Prabhakar Kummamuru (140 points)
#include <stdio.h>

int main()

{

      int num;

      scanf("%d", &num);

      while(num)

      {

           printf("%d ", num%10);

           num /= 10;

      }

      return 0;

}
0 votes
answered Jun 3, 2019 by anonymous
#include <stdio.h>

int main()

{

    int n;

printf("Enter a Number You want to Separate in Digits: ");

scanf("%d",&n);

while (n>0)

{

    n=n%10;

   printf("The digit are %d",n,);

   n=n/10;

}

return 0;

}
0 votes
answered Jun 14, 2019 by pavani kandukuri (180 points)
#include<stdio.h>

int main(){

int num,rem;

printf("enter the number:");

scanf("%d",&num);

while(num!=0){

rem=num%10;

printf("%d\n",rem);

num=num/10;

}

return 0;

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...