Skip to content

Instantly share code, notes, and snippets.

@icemilo
Created July 4, 2015 15:29
Show Gist options
  • Save icemilo/b20674494be1f6102e47 to your computer and use it in GitHub Desktop.
Save icemilo/b20674494be1f6102e47 to your computer and use it in GitHub Desktop.
Inverse Integer
//
// main.c
// InverseNumber
//
// Created by JAE SEUNG KOO on 7/4/15.
// Copyright (c) 2015 JAE SEUNG KOO. All rights reserved.
//
#include <stdio.h>
void inverse_num(int);
int main(int argc, const char * argv[]) {
int num = 0;
printf("input number : ");
scanf("%d", &num);
for(;num%10==0;num=num/10);
if(num < 0){
num *= -1;
printf("-");
}
inverse_num(num);
return 0;
}
void inverse_num(int num){
if(num == 0)
return;
printf("%d", num%10);
inverse_num(num/10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment