函數大致分為兩類,如下:-
這些函數已在系統函式庫中定義。
y= sqrt (x) x number must be positive eg: y = sqrt (25) then ‘y’ = 5
printf ( ) 存在於stdio.h 函式庫中。
#include<stdio.h> #include<conio.h> #include<math.h> main ( ){ int x,y; clrscr ( ); printf ("enter a positive number"); scanf (" %d", &x) y = sqrt(x); printf("squareroot = %d", y); getch(); }
Enter a positive number 25 Squareroot = 5
#include<stdio.h> #include<math.h> main ( ){ int x,y,z,n,k,p,r,q; printf ("enter x and n values:"); scanf (" %d%d", &x,&y) y=cbrt(x); z=exp(x); k=log(x); p=ceil(x); q=pow(x,r); printf("cuberoot = %d", y); printf("exponent value = %d",z); printf("logarithmic value = %d", k); printf("ceil value = %d", p); printf("power = %d", q); getch(); }
enter x and n values:9 2 cuberoot = 2 exponent value = 8103 logarithmic value = 2 ceil value = 9 power = 81
以上是C語言中的預定義函數有哪些?的詳細內容。更多資訊請關注PHP中文網其他相關文章!