- 2

Find the c program to print the alternate digits in a number

Take the input value of n as n=12345 and output will be 135

26th Nov 2018, 7:13 PM
Chandrasekaran
Chandrasekaran - avatar
1 ответ
0
So you want to make a number from the odd digits? If yes then try something like this: while(n>0){ if(n%10%2!=0) nr=nr*10+(n%10); n/=10 } cout<<nr;
26th Nov 2018, 7:27 PM
Stefan Secrieru
Stefan Secrieru - avatar