add xunhuan

This commit is contained in:
zibright 2025-05-08 19:52:29 +08:00
parent 1be7252d9c
commit b59c0ba7ab
10 changed files with 98 additions and 12 deletions

Binary file not shown.

BIN
Code/output/test1 Normal file

Binary file not shown.

BIN
Code/output/test2 Normal file

Binary file not shown.

BIN
Code/output/xunhuan1 Normal file

Binary file not shown.

BIN
Code/output/xunhuan2 Normal file

Binary file not shown.

BIN
Code/output/yinyee Normal file

Binary file not shown.

View File

@ -1,12 +0,0 @@
#include <stdio.h>
int main()
{
return 0;
}

12
Code/xunhuan1.c Normal file
View File

@ -0,0 +1,12 @@
#include<stdio.h>
int main()
{
int x = 0,i = 0;
for(i = 1; i <= 100; i++)
{
x += i;
}
printf("%d\n", x);
return 0;
}

22
Code/xunhuan2.c Normal file
View File

@ -0,0 +1,22 @@
#include<stdio.h>
int main()
{
int x = 0,y = 0;
while(1)
{
scanf("%d %d", &x , &y);
if(x > y)
printf("%d\n", x);
else if(x < y)
printf("%d\n", y);
else
{
printf("x = y\nexit\n");
break;
}
}
return 0;
}

64
Code/yinyee.c Normal file
View File

@ -0,0 +1,64 @@
#include <stdio.h>
int main()
{
float yye;
int grade;
printf("请输入营业额:(W)\n");
scanf("%f",&yye);
if(yye > 100)
grade = 6;
else if(yye > 80)
grade = 5;
else if(yye > 40)
grade = 4;
else if(yye > 20)
grade = 3;
else if(yye > 10)
grade = 2;
else if(yye > 0)
grade = 1;
else
{
printf("营业额不能为0或负数\n");
return 0;
}
switch(grade)
{
case 1:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.1);
break;
}
case 2:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.075);
break;
}
case 3:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.05);
break;
}
case 4:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.03);
break;
}
case 5:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.015);
break;
}
case 6:
{
printf("需要缴纳%.2fW的加盟费\n",yye*0.01);
break;
}
}
return 0;
}