Update C code projects and configurations
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
double a, b, c;
|
||||
scanf("%lf %lf", &a, &b);
|
||||
c = a / b;
|
||||
printf("%.0f/%.0f=%.2f\n", a, b, c);
|
||||
|
||||
return 0;
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int max(int a, int b);
|
||||
|
||||
int main()
|
||||
{
|
||||
int a, b,c;
|
||||
scanf("%d %d", &a, &b);
|
||||
|
||||
c = max(a, b);
|
||||
|
||||
printf("%d和%d的最大数是%d", a, b, c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int max(int a, int b)
|
||||
{
|
||||
int c = a;
|
||||
|
||||
if (a<b)
|
||||
{
|
||||
c = b;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int sign = 1;
|
||||
int n;
|
||||
printf("ÇëÊäÈën: ");
|
||||
scanf("%d", &n);
|
||||
double deno = 2.0, sum = 1.0, term;
|
||||
|
||||
while (deno <= n)
|
||||
{
|
||||
sign = -sign;
|
||||
term = sign / deno;
|
||||
sum = sum + term;
|
||||
deno = deno + 1;
|
||||
}
|
||||
printf("%f\n", sum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char c = 'Y';
|
||||
putchar(66); // B
|
||||
putchar('O'); // O
|
||||
putchar(c); // Y
|
||||
putchar('\n');
|
||||
|
||||
char a, b;
|
||||
a = getchar();
|
||||
b = getchar();
|
||||
putchar(a);
|
||||
putchar(b);
|
||||
|
||||
putchar(getchar());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char c1, c2;
|
||||
printf("请输入一个大写字母");
|
||||
c1 = getchar();
|
||||
c2 = c1 + 32;
|
||||
printf("转换后的小写字母为");
|
||||
putchar(c2);
|
||||
putchar('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int a, b, c;
|
||||
a = b = c = 0;
|
||||
a++ &&b++ | c++;
|
||||
printf("%d,%d,%d\n",a,b,c);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
double a, b,c;
|
||||
printf("输入你的体重(kg)和你的身高(cm)\n");
|
||||
scanf("%lf %lf",&a,&b);
|
||||
|
||||
b /= 100;
|
||||
c=a/(b*b);
|
||||
|
||||
if(c< 18)
|
||||
{
|
||||
printf("BMI是%.2f,你太轻了\n",c);
|
||||
}
|
||||
else if (c > 24)
|
||||
{
|
||||
printf("BMI是%.2f,你有点胖\n",c);
|
||||
}
|
||||
else if (18 <= c && c <= 24)
|
||||
{
|
||||
printf("BMI是%.2f,你的体重正常\n",c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user