首页 > 代码库 > c预言第三次作业周子济160809308

c预言第三次作业周子济160809308

#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");    }
#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 ; }
#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");}
#include<stdio.h>int main()//计算华氏温度100°F对应的摄氏温度{    int F=100;    int C;    printf("C=%d",C=5*(F-32)/9);    return 0;}
#include<stdio.h>int main()//100米自由落体{    int g=10;    int t=3;    int height;    height=0.5*g*t*t;    printf("height=%d",height);    return 0;}
#include<stdio.h>int main()//成绩{ char score; scanf("%c",&score); switch(score) { caseA: printf("90~100"); break; caseB: printf("80~89"); break; caseC: printf("70~79"); break; caseD: printf("60~69"); break; caseE: printf("0~59"); break; default: printf("输入有误"); break;  } return 0;}
#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()//计算存款利息{    int year,money;    double rate,interest;    printf("请输入存期");    scanf("%d",&year);    printf("请输入存款金额");    scanf("%d",&money);    printf("请输入年利率");    scanf("%lf",&rate);     interest=money*pow(1+rate,year)-money;    printf("利息为%f",interest);return 0;}
#include<stdio.h>#include<math.h>int main()//计算电费 {    double x,y;    scanf("%lf",&x);    if(x<=50)            y=0.53*x;    else            y=0.53*50+(x-50)*0.58;     printf("电费=%f",y);    return 0; }
#include<stdio.h>int main()//152的个位数字、十位数字和百位数字的值{    int a=152;    int b;    int c;    int d;    b=a%10;    c=(a/10)%10;    d=a/100;    printf("个位数字的值=%d\n",b);    printf("十位数字的值=%d\n",c);    printf("百位数字的值=%d\n",d);    return 0;}

 

c预言第三次作业周子济160809308