我要找C语言代码

来源:百度知道 编辑:UC知道 时间:2024/06/16 12:27:08
编写一个程序,从键盘输入一个X,Y,Z3个数,编写函数计算3个数的立方和并返回计算结果:S=X的立方+Y的立方+Z的立方。

#include<stdio.h>
long cube(int x,int y,int z)
{return x*x*x+y*y*y+z*z*z;
}
void main()
{
int x,y,z;
printf("Input three number.\");
scanf("%d%d%d",&x,&y,&z);
printf("%ld",cube(x,y,z));

}

你是初学者吗?