标签:
1.#include<stdio.h>//三角形 int main() { printf("*\n"); printf("**\n"); printf("***\n"); printf("****\n"); printf("*****\n"); printf("******\n"); printf("*******\n"); printf("********\n"); printf("*********\n"); printf("**********\n");
return 0; }
2.#include<stdio.h>//矩形 int main() { printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); return 0; }
3.#include<stdio.h>//倒三角形 int main() { printf("**********\n"); printf("*********\n"); printf("********\n"); printf("*******\n"); printf("******\n"); printf("*****\n"); printf("****\n"); printf("***\n"); printf("**\n"); printf("*\n");
return 0; }
4.#include<stdio.h> // 成绩 int main() { char score; scanf("%c",&score); switch (score) { case ‘A‘: printf("90~100"); break; case ‘B‘: printf("80~89"); break; case ‘C‘: printf("70~79"); break; case ‘D‘: printf("60~69"); break; case ‘E‘: printf("0~59"); break; }
return 0; }
5.#include<stdio.h> //温度的转换 int main() { int F=100;//F为华氏温度,C为摄氏温度 int C; C=(5*(F-32)/9); printf("%d",C); return 0; }
6.#include<stdio.h>//下落距离 int main() { int t=3; int g=10; int H;//下落高度 H=0.5*g*t*t; printf("f(t)=%d",H); return 0; }
7.#include<stdio.h> int main() { int a,b,c,x; x=152; a=x%10; b=(x/10)%10; c=x/100; printf() }
8.#include<stdio.h> #include<math.h> int main()//函数 { double x; double y; scanf("%lf",&x); if(x>=0) y=sqrt(x); else y=pow(x+1,2)+2*x+1/x; printf("f(x)=%f",y); return 0; }
#include<stdio.h> 电费 #include<math.h> int main() { double x; double cost; printf("请输入x的值"); scanf("%lf",&x); if(x>0&&x<=50) printf("cost=%f",cost=0.53*x); else if(x>50) printf("cost=%f",cost= 50*0.53+(x-50)*0.58); else printf("Invalid Value!"); }
标签:
原文地址:http://www.cnblogs.com/zyz9641/p/5920881.html