摘要: #include<stdio.h>int main(){ int N,M; double c,b,a; scanf("%d %d",&N,&M); c=(double)(N-M)*100/M;//(double)强制转换 N-M的值为int类型 加入(double)让他的值强制转换成double类型 阅读全文
posted @ 2020-12-21 15:32 Totoro13 阅读(1568) 评论(0) 推荐(0)
摘要: 单一出口指的是 在运行过程中不会先输出值 而是先运行列例如判断素数问题 只会先判断yes no不会先输出 等到结尾运行到return语句的时候才会输出是否素数 阅读全文
posted @ 2020-12-04 14:50 Totoro13 阅读(95) 评论(0) 推荐(0)
摘要: #include<stdio.h>int main(){ int a = 1, b = 1, n, sum = 0, i = 2; scanf("%d",&n); if(n == 1) {printf("1");} else { while(sum < n) { sum = a + b; a = b 阅读全文
posted @ 2020-12-01 20:22 Totoro13 阅读(54) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<math.h>int main(){ int b=0,n, sum = 0,i; scanf("%d",&n); for (i = 1; i <= n; i++) { b = pow(2, i); sum += b; } printf("resul 阅读全文
posted @ 2020-12-01 19:31 Totoro13 阅读(43) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<math.h>int fact(int n);int main(){ int i,N, sum=0; scanf_s("%d",&N); for (i = 1; i <= N; i++) { sum += fact(i); } printf("%d 阅读全文
posted @ 2020-12-01 19:24 Totoro13 阅读(145) 评论(0) 推荐(0)