u

Thursday, 7 June 2012

c++ Program to return the inverse of any entered number

C++ Program to return the inverse of any entered number


# include <iostream.h>
#include<conio.h>
int function(int g);
int main()
{
 int n,
     exit;
 cout <<"this program will give the inverse of any number:"<<"\t";
 cin>>n;
 function(n);
 cout<<"\n"<<"print exit to quit this program:"<<"\t";
 getch();
 return 0;
}

int function(int g)
{
 int p=1,
     f,
     i;
 while (p!=0)
{
 p=g/10;
 f=p*10;
 i=g-f;
 g=p;
 cout<<i;
}

 return i;
}

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More