0

find inverse of number

29th Aug 2016, 4:31 PM
Satyam Rai
Satyam Rai - avatar
4 Respostas
+ 1
double inv(double d) { return 1/d; }
29th Aug 2016, 6:11 PM
Zen
Zen - avatar
+ 1
#include <iostream> using namespace std; double inv(double); int main() { double y; cin>>y; inv(y); return 0; } double inv(double d) { double x; x=1/d; cout<<x<<endl; }
31st Aug 2016, 2:51 AM
Vjmsd
Vjmsd - avatar
+ 1
there is a difference between inverse and reverse of a number
31st Aug 2016, 2:53 AM
Vjmsd
Vjmsd - avatar
0
#include <iostream.h> #include <conio.h> void main() {   clrscr();  //clears the screen         int n, num, digit, rev = 0;      cout << "Enter a positive number: ";      cin >> num;      n = num;      do      {          digit = num%10;          rev = (rev*10) + digit;          num = num/10;      }while (num!=0);      cout << " The reverse of the number is: " << rev  getch(); }
30th Aug 2016, 11:31 AM
Hritesh Mourya
Hritesh Mourya - avatar