int sum()
{
int x,y,r=0;
printf("please input x and y\n");
scanf("%d %d",&x,&y);
r = x+y;
return r;
}
main(){
int r;
r = sum();
printf("sum=%d\n",r);
return 0;
}
函数(sum),传入2个整数(x,y),在函数中列印2个数的和(total).
函数(sum),传入2个整数(x,y),在函数中列印2个数的和(total).
函数(sum),不传入任何参数,在函数中输入2个整数,回传2个数的和(total).
程式实作
1.试撰写加总(sum)函数,此函数接收二个整数(x,y),接著计算其总和(total),并回传给主程式.请以一主程式测试之.
2.试撰写一函数(cube),此函数接收一个整数(n),接著计算此一整数之立方(cube_num),并回传给主程式.请以一主程式测试之.
3.试撰写一函数(compare),此函数接收三个整数(a,b,c),比较出最大值(max),并回传给主程式.请以一主程式测试之.
今天一定要..拜托了...
上面都不要了..
换这条..
函数(sum),不传入任何参数,在函数中输入2个整数,回传2个数的和(total).
麻烦了...
函数(sum),不传入任何参数,在函数中输入2个整数,回传2个数的和(total).
程式实作
1.试撰写加总(sum)函数,此函数接收二个整数(x,y),接著计算其总和(total),并回传给主程式.请以一主程式测试之.
2.试撰写一函数(cube),此函数接收一个整数(n),接著计算此一整数之立方(cube_num),并回传给主程式.请以一主程式测试之.
3.试撰写一函数(compare),此函数接收三个整数(a,b,c),比较出最大值(max),并回传给主程式.请以一主程式测试之.
今天一定要..拜托了...
上面都不要了..
换这条..
函数(sum),不传入任何参数,在函数中输入2个整数,回传2个数的和(total).
麻烦了...
其他人气:415 ℃时间:2020-01-25 08:31:13
优质解答
我来回答
类似推荐
猜你喜欢
- 1the man who is driving a car is my fathr.与the man driving a car is my father.
- 2in the last three years和in the past three years的区别
- 3讨论关于x的方程lg(x-1)+lg(3-x)=lg(a-x)的根的个数
- 4Only with the help or their college or university can American students find jobs.是什么句子结构
- 5how can i show my love for a girl
- 6VC++6.0 一个四位数(0000~9999) 分别输出各个数位的数
- 7(1) I went to the mountain on my vacation. (否定句)_________________________________________________
- 8everyone in our class like english very much(改错)
- 9两组同学进行跳绳比赛、平均每人跳152下.甲组有6人,平均每人跳140下;乙组同学平均每人跳160下,乙组有多少人?
- 10四年级上册13白鹅的多音字,马上就要用(写作业).加油