#include//1.三角形int main(){ printf("*\n"); printf("**\n"); printf("***\n"); printf("****\n"); printf("*****\n"); printf("******\n"); printf("*******\n"); printf("********\n"); printf("*********\n"); printf("**********\n"); }
#include//2.十行矩形 int main(){ printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n"); printf("**********\n");}
#include//3.倒三角形 int main(){ printf("**********\n"); printf("*********\n"); printf("********\n"); printf("*******\n"); printf("******\n"); printf("*****\n"); printf("****\n"); printf("***\n"); printf("**\n"); printf("*\n");}
#include// 4.五级制成绩 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; } }
#include//7. 显示个位数字,十位数字和百位数字的值。 #include int main(){ int t[10]={ 0}; int a; scanf("%d",&a); int i=0; while(a!=0) { t[i++]=a%10; a=a/10; } int j; for(j=0;j<=i;j++) printf("%.0f",(t[j]*pow(10,j)))
#include//8.分段函数#include 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); }