How to make a c language program to reverse of a five digits number without use of loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to make a c language program to reverse of a five digits number without use of loop?

please tell me .

6th Aug 2018, 6:02 AM
Ashish Rastogi
Ashish Rastogi - avatar
5 Answers
6th Aug 2018, 9:38 AM
MO ELomari
+ 1
you can take the number into a string and use strrev()
6th Aug 2018, 7:40 AM
hinanawi
hinanawi - avatar
6th Aug 2018, 9:25 AM
MO ELomari
+ 1
long x,rev; x=12345; rev=(x/10000)%10+10*((x/1000)%10)+100*((x/100)%10)+1000*((x/10)%10)+10000*(x%10); printf("%d",rev);
6th Aug 2018, 1:30 PM
VcC
VcC - avatar
0
Use recursion
6th Aug 2018, 6:21 AM
Jerome Esplana
Jerome Esplana - avatar