最新回答 / 慕UI9091795
hello.c#include <stdio.h>int main() { int score = 87; //考试分数为87分 重点在这里,case 里是比对第十位的大小进行了判断,我们需要简化下输入 score=score/10 (这里得到的是分数的第十位数值,然后就能判断了,但十位是9和10(既是100分)的时候都是A级,因为case 10和9只有一个braek,一个级别需要一个break。) 我说清楚了吗? switch(score) { /*想想以...
2017-03-21
最新回答 / AngerKyle
#include <stdio.h>int main(){ //定义三位数num,个位数sd,十位数td,百位数hd int num, sd, td, hd; //循环所有三位数 for(num>=100; num<1000 ;num++ ) { //获取三位数字num百位上的数字 hd = num/100 ; //获取三位数字num十位上的数字 td = ...
2017-03-20
最新回答 / 慕粉2210442183
#include<stdio.h>#include<math.h>int main(){int a,b,c;double delta;double x1;double x2;delta=b*b-4*a*c;printf("请输入a b c的值\n");scanf("%d,%d,%d",&a,&b,&c);if (delta>0) {x1=(-b+sqrt(delta))/(2*a); x2=(-b-sqrt(delta))/(2*a); printf(...
2017-03-20
最新回答 / 慕粉1954481569
参考答案错了//使用while循环 while(i<=100) { if(i%2==0) { flag = -1; } else { flag = 1; } sum += i * flag; i++; }这样就行了
2017-03-19
最新回答 / 慕learner
#include <stdio.h>int main(){ int sum = 0; int i; for(i=1; i<=10; i++) { printf("%d\n", i); if(i==3)//当i==3时跳出循环执行loop语句 goto loop; //在这里使用goto语句 } loop:printf("结束for循环了...."); //添加loop标识符 return 0; ...
2017-03-19