include "stdio.h"int lifang(int num); //求一个数的立方void main(){int a,b,c;int sum;printf("请输入三个整数:\n");scanf("%d%d%d",&a,&b,&c);sum = lifang(a)+lifang(b)+lifang(c);printf("%d、%d和%d的立方和为:%d\n",a,b,c,sum);} int lifang(int num){int ...
include <stdio.h> include <math.h> int is(int n) { int sum = 0, m = n;do { int r = m % 10;sum += r * r * r;} while(m/=10);if(sum == n) return 1;return 0;} int main(){ int m, n;scanf("%d%d",&m,&n);for(int i = m; i <=n; ++i){ if...
printf("立方和为:%lf",sum); } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 输出运行窗口如下: 本周其他练习 C语言程序设计专栏 C语言编程>第五周 ① 目前人民币共有以下几种面值(不包括角和): 1元 2元 5元 10元 20元 50元 100元 编写一个函数计算金额“X“需要多少...
//编写函数 求两个数的平方,立方和及平方,立方差#include <stdio.h>int pingfang(int x){return x*x;}int lifang(int x){return x*x*x;}int pingfangcha(int x,int y){return pingfang(x) - pingfang(y);}int lifangcha(int x,int y){return lifang(x) - lifang(y);}int main...
include <stdio.h>void main(){ int n, i; int sum = 0; printf("请输入一个整数:"); scanf("%d", &n) for( i=1; i<=n; i++) { sum += (i*i*i); } printf("1~%d的立方和为:%d\n", n, sum);}/* 如果还有疑问请追问. 如果解决了您的问题...
int func1(int t,int n){ //设func1为n次方函数,其中t为底数,n为幂指数,及形如func1=t^n if(n==0) return 1;else if(n==1) return t;else { return t*func1(t,n-1); //此处用到递归算法 } } int func2(){ int num1,num2,num3;int sum;sum=func1(num1,...
1、c语言中定义函数和调用函数(计算int型整数的立方) #include <stdio.h>intcube(inta) {returna * a *a; }intmain(void) {intn1; puts("please input an integer."); printf("n1 ="); scanf("%d", &n1); printf("the cube = %d\n", cube(n1));return0; ...
int a, b;printf("输入两个数,用空格分开:");scanf("%d %d", &a, &b);printf("和的立方是...
int mypow(int a,int b){ return a*a*a+b*b*b;}
include<stdio.h>int main(){ int n,x,i,j; scanf("%d",&n); while(n--) {scanf("%d",&x); if(x<0) {printf("No\n"); continue; } for(i=1;i*i*i<=x;i++); --i; x-=i*i*i; for(j=1;j*j*j<=x;j++); --j; x-=j...