Thursday, December 14, 2017

C++ 5-Digit Integer Split Into 5

#include <iostream>
using namespace std;

int main()
{

 cout << "Enter 5-digit integer:\n";
 int num;
  cin >> num;
 
 cout << num / 10000 << "   ";
 num = num % 10000;

 cout << num / 1000 << "   ";
 num = num % 1000;
 
 cout << num / 100 << "   ";
 num = num % 100;
 
 cout << num / 10 << "   ";
 num = num % 10;
 
 cout << num << "\n\n";

return 0;

}

No comments:

Post a Comment