Function seperateDigit() execute recursively.
/* title: seperatingDigits author: aeriqusyairi date: jan23 2012 */ #include<stdio.h> int seperateDigit(int); int main(){ int number = 0; printf("input an integer:"); scanf("%d", &number); seperateDigit(number); printf("\n"); system("pause"); return 0; } int seperateDigit(int integer){ if(integer <= 0){ return; }else{ seperateDigit( integer / 10 ); printf("%2d", integer % 10 ); } }
No comments:
Post a Comment