I\'m new to programming, and I\'m stuck at a problem. I want my program to identify the separate digits in a given number, like if I input 4692, it should ident
Here is a simple solution if you want to just print the digits from the number.
#include
/**
printdigits
*/
void printDigits(int num) {
char buff[128] = "";
sprintf(buff, "%d ", num);
int i = 0;
while (buff[i] != '\0') {
printf("%c ", buff[i]);
i++;
}
printf("\n");
}
/*
main function
*/
int main(int argc, char** argv) {
int digits = 4321;
printDigits(digits);
return 0;
}