写一个求变量平方和的平方根函数,
/* Note:sqrt*/
#include "stdio.h"
#include"math.h"
double getZ(double x,double y,double z){
double r;
r=sqrt(x*x+y*y+z*z);
return r;
/* get easier:return sqrt(x*x+y*y+z*z);*/
}
int main()
{double x,y,z,w;
x=3;
y=4;
z=5;
w=getZ(x,y,z);
printf("x=%f,y=%f.z=%f,w=%f",x,y,z,getZ(x,y,z));
}
无参数无返回值
#include "stdio.h"
void sayhello()
{
printf("sayhello");
}
void main()
{
sayhello();
}