Float Division Without /operator
Jun 22, 2013 at 7:23pm Jun 22, 2013 at 7:23pm UTC
Well i want to divide 5.9 to 3.6 ,, looks something 5.9/3.6 should give 1.63 Now My way of doing it is .
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream.h>
#include <math.h>
int main(){
while (1){
float num, den;
cout<< "Enter num :=:" ; cin >> num;
cout<< "Enter den :=:" ; cin >> denom;
cout<<num*pow(den,-1)<<"\n\n" ;
cout<<"-----------------------------\n\n" ;
}
return 0;
}
but the worst part is when i've studied pow() , it is using -ve exponent as c=(1/e*n) & c*=den ; Now here i come to think how to do it right way and got stuck.
Last edited on Jun 22, 2013 at 7:32pm Jun 22, 2013 at 7:32pm UTC
Topic archived. No new replies allowed.