Skip to content

Instantly share code, notes, and snippets.

@karol-may
Created October 23, 2011 09:37
Show Gist options
  • Save karol-may/1307177 to your computer and use it in GitHub Desktop.
Save karol-may/1307177 to your computer and use it in GitHub Desktop.
zadanie 23/10/11 7
#include <stdio.h>
#include <math.h>
int main()
{
double x,r,i;
scanf("%lf", &x);
if (x>0){
r = sqrt(x);
i = 1/x;
printf(" \t Number: %lf\n\t Root: %lf\n\t Multiplicative inverse: %lf\n",x,r,i);
}
else if ( x==0 ){
r = 0;
printf(" \t Number: %lf\n\t Root: %lf\n\t Multiplicative inverse: N\\A\n",x,r);
}
else if ( x<0 ){
i = 1/x;
printf(" \t Number: %lf\n\t Root: N\\A\n\t Multiplicative inverse: %lf\n",x,i);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment