GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

how 49 can be split into 4 and 9 without using multiplication and division operator?

asked Jul 2, 2016 by santosh

1 Answer

#include <iostream>
using namespace std;
int main() {
	int a=49;
	string str=to_string(a);
	cout<<str[0]<<" "<<str[1]<<endl;
	return 0;

Convert the number into the string and access the digits of number as an array.

answered Jul 2, 2016 by sourabhmnnit