Reverse number | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Reverse number

Reverse a number mean moving the digit at the last position to the first'position and vice versa

1st Sep 2023, 8:50 AM
Nandhini Veerendra
Nandhini Veerendra - avatar
3 Antworten
+ 5
Your code is correct then what's your question?
1st Sep 2023, 9:42 AM
Sakshi
Sakshi - avatar
+ 1
this place is for asking questions not for asking answer , use feed section for solutions or answer others questions
2nd Sep 2023, 9:40 AM
Alhaaz
Alhaaz - avatar
0
#include <stdio.h> int main() { int n,r,rev=0; printf("\n Enter a number:"); scanf("%d",&n); while(n!=0) { r=n%10; rev=(rev*10)+r; n/=10; } printf("Reversed string=%d", rev); }
1st Sep 2023, 8:51 AM
Nandhini Veerendra
Nandhini Veerendra - avatar