Answers for "Split a number and store it in vector"

C++
0

Split a number and store it in vector

#include <bits/stdc++.h>
using namespace std;
main() {
	int n = 1213456;
	vector<int> v;
	for(; n; n/=10)
  		v.push_back( n%10 );
	reverse(v.begin(), v.end());
	for (auto &i : v) cout<<i;
}
Posted by: Guest on March-27-2021

Code answers related to "Split a number and store it in vector"

Browse Popular Code Answers by Language