33 lines
477 B
C
33 lines
477 B
C
#include<stdio.h>
|
|
|
|
int main() {
|
|
// scan integer from input
|
|
int x;
|
|
scanf("%d", &x);
|
|
|
|
// Get the 5 digits, starting from 1s place
|
|
int ones = x %10;
|
|
|
|
x/=10;
|
|
int tens = x % 10;
|
|
|
|
x/=10;
|
|
int hundreds = x % 10;
|
|
|
|
x/=10;
|
|
int thousands = x % 10;
|
|
|
|
x/=10;
|
|
int tenthousands = x % 10;
|
|
|
|
// In reverse order, create the reversed number.
|
|
int reversed = tenthousands
|
|
+ 10*thousands
|
|
+ 100*hundreds
|
|
+ 1000*tens
|
|
+ 10000*ones;
|
|
|
|
// Output number.
|
|
printf("%d\n", reversed);
|
|
}
|