Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

print digits of a number in c

#include <stdio.h>

int main(){
    int num = 1024;

    while(num != 0){
        int digit = num % 10;
        num = num / 10;
        printf("%d
", digit);
    }
  
    return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #digits #number
ADD COMMENT
Topic
Name
8+6 =