码迷,mamicode.com
首页 > 其他好文 > 详细

钟国晨 160809323(作业3)

时间:2016-09-28 10:09:36      阅读:107      评论:0      收藏: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");
    return 0; 
}
#include<stdio.h>
int main()
{
    printf("**********\n*********\n********\n*******\n******\n*****\n****\n***\n**\n*\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()
{
    char score;
    printf("请输出等级:"); 
    scanf ("%c",&score);//A B C D E 
    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("输入有误\n");
    break;     
  }
  return 0;
}
#include<stdio.h> //华氏温度与摄氏温度的转换 
int main()
{
    int F=100;//F为华氏温度,C为摄氏温度 
    int C;
    C=(5*(F-32)/9); 
    printf("%d",C);
    return 0;
}
#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;    
} 
#include<stdio.h>//152的个、十、百位数值
int main()
{
    int a,b,c,d;
    a=152;
    b=a/100;
    c=(a/10)%10;
    d=a%10;
    printf("百位是%d 十位是%d 个位是%d",b,c,d);
    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);
} 
#include<stdio.h>//计算利息 
#include<math.h>
int main()
{
    int year;
    int money;
    double rate;
    double interest;
    printf("请输入存期"); 
    scanf("%d",&year) ;
    printf("请输入存款金额") ;
    scanf("%d",&money);
    printf("年利率");
    scanf("%lf",&rate);
    interest=money*pow(1+rate,year)-money;
    printf("到期时利息为%f",interest); 
} 
#include<stdio.h>//计算电费 
int main()
{
    double x;
    double y;
    scanf("%lf",&x);
    if(x<=50)
    y=0.53*x;
    else
    y=0.53*50+(x-50)*0.58;
    printf("f(x)=%f",y);
}

 

钟国晨 160809323(作业3)

标签:

原文地址:http://www.cnblogs.com/zgc1540161699/p/5915103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!