首页 > 代码库 > 陈睿豪第三次作业

陈睿豪第三次作业

#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");}

 

#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()//求152个十百位 {    int a=152;    int b;    int c;    int d;    b=a/100;    c=(a/10)%10;    d=a%10;    printf("%d %d %d",b,c,d);}
#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;     }   }
#include<stdio.h>int main()//华氏温度转摄氏温度 {    int f;    int c;    printf("输入华氏温度: ");     scanf("%d",&f);        c=5*(f-32)/9;    printf("%d",c);}
#include<stdio.h>#include<math.h>int main()//100米小球落下 {    int g=10;    int t=3;    double h;            h=pow(t,2)*1/2*g;    printf("%f\n",h);}
#include<stdio.h>#include<math.h>int main() //分段函数 {    double x;    double y;    printf("请输入一个值:");    scanf("%lf",&x);    if(x>=0)        y=sqrt(x);    else        y=pow(x+1,2)+2*x+1/x;    printf("f(x)=%.2f",y);}
#include<stdio.h>#include<math.h>int main()//计算存款利息 {    int money;    int year;     double rate;    double interest;    printf("输入存款金额: ");    scanf("%d",&money);    printf("输入存期: ");    scanf("%d",&year);    printf("输入年利率: ");    scanf("%lf",&rate);    interest=money*pow(1+rate,year)-money;    printf("interest=%.2f\n",interest);}
#include<stdio.h>int main()//阶梯电价 {    float n;    printf("月用电量: ");    scanf("%f",&n);    if(n>50)        printf("月电费:%f\n",50*0.53+(n-50)*(0.53+0.05));    else        printf("月电费:%f\n",n*0.53);}

 

陈睿豪第三次作业