摘要: #include<stdio.h>int main(void){ printf("输出倒三角图案:\n"); printf("* * * *\n"); printf(" * * *\n"); printf(" * *\n"); printf(" *\n"); return 0;} 阅读全文
posted @ 2023-12-03 17:28 Grit_Doyle 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void) { printf("输出短句:Programming in C is fun!\n"); printf("Programming in C is fun!"); return 0;} 阅读全文
posted @ 2023-12-03 17:27 Grit_Doyle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>int main(void){ int i,n; double power; printf("Enter n:"); scanf("%d",&n); for(i=0;i<=n;i++){ power=pow(3,i); printf( 阅读全文
posted @ 2023-12-03 17:27 Grit_Doyle 阅读(10) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int a[4]; int i,sum; double average; printf("输入4个整数:\n"); for(i=0;i<4;i++){ scanf("%d",&a[i]); } for(i=0,sum=0;i<4;i+ 阅读全文
posted @ 2023-12-03 17:26 Grit_Doyle 阅读(8) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ double electricity,cost; printf("输入用电量:\n"); scanf("%lf",&electricity); if(electricity<=50) cost=electricity*0.53; el 阅读全文
posted @ 2023-12-03 17:25 Grit_Doyle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int celsius,fahr; //celsius摄氏温度,fahr华氏温度 scanf("%d",&fahr); celsius=5*(fahr-32)/9; //转换公式 printf("fahr=%d,celsius=%d\ 阅读全文
posted @ 2023-12-03 17:19 Grit_Doyle 阅读(7) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>double fact(int n);int main(void){ int m,n; double C; printf("n大于m Enter m:"); scanf("%d",&m); printf("n大于m Enter n:"); scanf("%d",&n 阅读全文
posted @ 2023-12-03 17:19 Grit_Doyle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int n,i,counter; double sum; i=1; sum=0; scanf("%d",&n); for(counter=1;counter<=n;counter++){ if(counter%2==0) sum=su 阅读全文
posted @ 2023-12-03 17:18 Grit_Doyle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int n,i,counter; double sum; i=1; sum=0; scanf("%d",&n); for(counter=1;counter<=n;counter++){ sum=sum+1.0/i; i+=2; } 阅读全文
posted @ 2023-12-03 17:17 Grit_Doyle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int n,i; double sum; sum=0; scanf("%d",&n); for(i=1;i<=n;i++){ sum=sum+1.0/i; } printf("sum=%lf",sum); return 0;} 阅读全文
posted @ 2023-12-03 17:17 Grit_Doyle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void) { int fahr,lower,upper; double celsius; scanf("%d",&lower); scanf("%d",&upper); if(lower<=upper) { printf("faher celsi 阅读全文
posted @ 2023-12-03 17:16 Grit_Doyle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>int main(void){ double x,y; scanf("%lf",&x); if(x>=0) y=sqrt(x); else y=pow(x+1,2)+2*x+1/x; printf("y=f(%lf)=%.2lf",x 阅读全文
posted @ 2023-12-03 17:15 Grit_Doyle 阅读(6) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ double x,y; scanf("%lf",&x); if(x==0) y=0; if(x!=0) y=1/x; printf("y=f(%lf)=%.1lf",x,y); return 0;} 阅读全文
posted @ 2023-12-03 17:15 Grit_Doyle 阅读(8) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int i1,i2; //定义两个数; int sum,different,product; //和,差,积 double quotient; //商 scanf("%d %d",&i1,&i2); sum=i1+i2; differ 阅读全文
posted @ 2023-12-03 17:14 Grit_Doyle 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int g,t; //g加速度,t下落时间 double s; //s下落距离 g=10; t=3; s=0.5*g*t*t; printf("s=%lf",s); return 0;} 阅读全文
posted @ 2023-12-03 17:13 Grit_Doyle 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int celsius,fahr; fahr=150; celsius=5*(fahr-32)/9; printf("fahr=%d,celsius=%d\n",fahr,celsius); return 0;} 阅读全文
posted @ 2023-12-03 17:12 Grit_Doyle 阅读(5) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void) { printf("1-100中能被6整除的所有数的和:\n"); int i,sum=0; //i是1-100间的数;sum是1-100中能被6整除的所有数的和 for(i=1; i<=100; i++) { if(i%6==0) { 阅读全文
posted @ 2023-12-03 17:08 Grit_Doyle 阅读(130) 评论(0) 推荐(0) 编辑