0
find inverse of number
4 Antworten
+ 1
double inv(double d) {
return 1/d;
}
+ 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;
}
+ 1
there is a difference between inverse and reverse of a number
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();
}