Command Line Program to Reverse a Number

Reverse a Number Command Line Argument

Write a C program which will reverse all the digits of a Number using Command Line Arguments to reverse the digits of a number

Comment your version on code in the comments section below – 

#include<stdio.h>
#include<stdlib.h>
int main (int argc, char *argv[])
{
  if (argc == 1)
    {
      printf ("No Arguments");
      return 0;
    }
  else
    {
      int n, reverseNumber, temp, rem;
      n = atoi (argv[1]);
      temp = n;
      reverseNumber = 0;
      while (temp)
	{
	  rem = temp % 10;
	  reverseNumber = reverseNumber * 10 + rem;
	  temp = temp / 10;
	}
      printf ("%d", reverseNumber);
      return 0;
    }
}