Skip to content

Commit

Permalink
Merge pull request #50 from ankitraj7994/master
Browse files Browse the repository at this point in the history
bug freed reverse.c and organized
  • Loading branch information
ambujraj committed Oct 1, 2018
2 parents 8de1a29 + f55e9a6 commit ab0dace
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
25 changes: 0 additions & 25 deletions reverse.cpp

This file was deleted.

21 changes: 21 additions & 0 deletions reverse/reverse.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdio.h>

int reversDigits(int num)
{
int rev_num = 0;
while(num)
{
rev_num = (rev_num*10) + num%10;
num /= 10;
}
return rev_num;
}

int main()
{
int num;
printf("Enter any number: ");
scanf("%d", &num);
printf("Reverse of no. is %d\n", reversDigits(num));
return 0;
}

0 comments on commit ab0dace

Please sign in to comment.