fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n = 240;
  6. int c = 0;
  7. int dig[30];
  8.  
  9. int index = 0;
  10. while(n>0){
  11. dig[index] = n%10;
  12. n = n/10;
  13. c++;
  14. }
  15.  
  16. for(int i=0; i<c; i++)
  17. cout << dig[i] << ' ';
  18. cout << endl;
  19. cout << c << endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 4500KB
stdin
Standard input is empty
stdout
2 10973 -1549951488 
3