标签:
#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) { 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; 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); }
标签:
原文地址:http://www.cnblogs.com/16-322/p/5922263.html