+ 3

Seprating line of numbers .

I want to enter a line of numbers like (1338265) and seperate the numbers by a space and place them all in an array . How can i do it?

5th Jan 2020, 7:40 PM
Maryam K
Maryam K - avatar
4 Respostas
5th Jan 2020, 8:16 PM
electron
electron - avatar
0
Array a[] of type int, and n is a number: while(n>0) { a[i] =n%10; cout<<a[i] <<" " ; n/=10; i++; } It will print reverse order. So use for loop to print array.... for(int j=0;j<i;j++) cout<<a[j]<<" ";
5th Jan 2020, 9:20 PM
Jayakrishna 🇮🇳
- 1
Hi
7th Jan 2020, 7:13 PM
PALANIYA NARENDRASINH