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

第三次作业160809322

时间:2016-09-30 01:50:59      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

#include<stdio.h>
int main()//华氏温度转摄氏温度 
{
    int f;
    int c;
    printf("输入华氏温度: "); 
    scanf("%d",&f);
        c=5*(f-32)/9;
    printf("%d",c);
}

 

#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()
{
    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>
#include<math.h>
int main()
 {
     int g=10;
     int t=3;
     int height;
     height=0.5*g*t*t;
      printf("h=%d",height);
      return 0; 
 }
#include<stdio.h>
#include<math.h>
int main()
{
    double x;
    double y;
    printf("请输入x的值:");
    scanf("%lf",&x);
    if(x>=0)
        y=sqrt(x);
    else
        y=pow(x-1,2)+2*x+1/x;
    printf("y=f(x)=%.2f",y);    
}
#include<stdio.h> 
#include<math.h>
int main() 
{
   int money,year;
   double rate,interest,a;
   printf("请输入存款金额:");
   scanf("%d",&money); 
   printf("请确认存期:"); 
   scanf("%d",&year);
   printf("请确认年利率:");
   scanf("%lf",&rate);
   a=pow(1+rate,year);
   interest=money*(a-1);
   printf("存款利息为:%f",interest);
}
#include <stdio.h>
int main()
{
   int x;
   double y;
   printf("请输入本月用电量:");
   scanf("%d",&x);
   if(x<=50)
      y=0.53*x;
   else
      y=50*0.53+(x-50)*0.58;
   printf("本月电费为:%.2lf",y);
}

 

第三次作业160809322

标签:

原文地址:http://www.cnblogs.com/16-322/p/5922263.html

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