Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void display_components(int n);
- int main()
- {
- int inp;
- printf("Enter: ");
- scanf("%d", &inp);
- display_components(inp);
- return 0;
- }
- void display_components(int n)
- {
- int i, div, frc;
- printf("= ");
- for (i = 10000; i > 0; i/=10)
- {
- if((i-n)<=1)
- {
- div = n/i;
- n = n%i;
- printf("%d", div*i);
- printf(i>9 ? " + ": NULL);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement