第一題 #include<stdio.h> int main() {ui
char ch; printf("請輸入字符:"); scanf("%c",&ch); if(isupper(ch)) printf("%c",totower(ch)); else printf("%c",ch); getchar(); getchar(); return 0;
} 第二題 #include<stdio.h> int main() {code
float x, y; printf("輸入x:"); scanf("%f",&x); if (x>8) y=x-3*x*x*x-9; else if(x<0) y=x-3*x*x*x-9; else y=x+2*x*x+10; printf("%f",y); getchar(); return 0;
} 第3題 #include<stdio.h> int main () {get
int score; printf("請輸入成績:"); scanf("%d",&score); if(score>=90) printf("%d爲優秀",score); else if(score>=80) printf("%d爲良好",score); else if(score>=70) printf("%d爲中等",score); else if(score>=60) printf("%d爲及格",score); else printf("%d爲不及格",score); getchar(); getchar(); return 0;
} 第4題(1) #include<stdio.h> int main () {io
float x,y; printf("請輸入x的值:"); scanf("%f",&x); y=(sin(x)+log(x+1))/(exp(x)+abs(cos(x))); printf("數字表達式的值爲:%f.\n",y); return 0;
} (2) #include<stdio.h> int main() {class
float x,y,y1,y2,y3,y4; printf("請輸入x的值:"); scanf("%f",&x); y1=sin(x); y2=log(x+1); y3=exp(x); y4=abs(cos(x)); y=(y1+y2)/(y3+y4); printf("表達式的值爲:%f\n",y); return 0;
} 第5題 #include<stdio.h> int main () {float
int x1,x2,x3; printf("三位數中的水仙花數:\n"); for(int i=100;i<1000;i++){ x1=i/100; x2=i/10%10; x3=i%10; if(i==(x1*x1*x1+x2*x2*x2+x3*x3*x3)) printf("%d\n",i); } return 0;
} 第6題 #include<stdio.h> int main() {im
int a,n,i,sn=0,j=0; printf("請輸入a的值:"); scanf("%d",&a); printf("請輸入n的值:"); scanf("%d",&n); for(int i=0,i<n;i++){ j=j+a; sn=sn+j; j=j*10; } printf("S%d=%d\n",n,sn); return 0;
} 第7題 #include<stdio.h> int main() {di
int n,i,count; printf("請輸入一個數:"); scanf("%d",&n); i=n while(n!=0) { n/=10; count++; } printf("數字%d是%d位數",i,count); return 0;
} 第8題 #include<stdio.h> int main() {while
int time1,time2; printf("Enter a 24-hour time(xx:xx):"); scanf("%d:%d",&time1,&time2); if(time1<12 | | time1==24){ printf("Equivalent 12-hour time:%d:%dAM.\n",time1%12,time2); } else if(time==12){ printf("Equivalent 12-hour time:%d:%dPM.\n",time1,time2); } else{ printf("Equivalent 12-hour time:%d:%dPM.\n",time1%12,time2) } return 0;
} 第9題 #include<stdio.h> int main() {co
float value,broke; printf("Enter value of trade:"); scanf("%f",&value); if(value<2500)
}