Reverse a Number

Description:

Write a program which takes input Hours, Minutes, Seconds as integer and Calculates the total number of seconds. Test Case 1 Input (stdin) 10 50 10 Expected Output Seconds=39010 Test Case 2 Input (stdin) 20 30 20 Expected Output Seconds=73820

Program :

#include <iostream>

using namespace std;

int main()

{

int n,rev=0;

  cin>>n;

  while(n!=0)

  {

  rev=rev*10+n%10;

    n=n/10;

  }

  cout<<rev;

return 0;

}