Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<conio.h>
- //Math log, log10, sin, round, trunc, ceil, floor functions
- int main()
- {
- double x,y,result;
- printf("Enter the value of x: \n");
- scanf("%lf",&x);
- printf("Enter the value of Y: \n");
- scanf("%lf",&y);
- result=log(x);//log function computes the natural logarithm of an argument
- printf("log (%.0lf)=%.1lf\n",x,result);
- result=log10(x);//log10 function computes the base 10 logarithm of an argument.
- printf("log10(%.0lf)=%.1lf\n",x,result);
- result=sin(x);//sin function returns the sine of a number.
- printf("sin(%.0lf)=%.1lf\n",x,result);
- result=round(y);/*round function returns the nearest integer value of the
- float/double/long double argument passed to this function */
- printf("round of %lf=%.1lf\n",y,result);
- result=trunc(y);/*trunc functions are used to remove digits after
- decimal point and return the modified decimal number. */
- printf("trunc of %lf=%.1lf\n",y,result);
- result=ceil(y);//ceil function computes the nearest integer greater than the argument passed.
- printf("ceil of %lf=%.1lf \n",y,result);
- result=floor(y);//floor calculates the nearest integer less than the argument passed.
- printf("floor of %lf=%.1lf\n",y,result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement