#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) { 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> //华氏温度与摄氏温度的转换 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); }
时间: 2024-12-11 02:04:56