">以下程序运行后的输出结果是#include
int main()
{
int a=5,b=4,c=3,d;
d=(a>b>c);
printf("%d\n",d);
return 0;
}
#include
int main()
{
int a=5,b=4,c=3,d;
d=(a>b>c);
printf("%d\n",d);
return 0;
}
#include
int main()
{
int a=3,b=4,c=5,d=2;
if(a>b)
{
if(b>c)
{
printf("%d",d++ +1);
}
else
{
printf("%d",++d +1);
}
}
printf("%d\n",d);
return 0;
}
#include
int main()
{
int a,b;
printf("please input a and b:\n");
scanf("%d%d",&a,&b);
printf("the output data is %d\n",a<b?b:a);
return 0;
}从键盘输入以下数据:27则程序输出为
#include
int main()
{ int a,b,c;
a=10;
b=20;
c=(a%b1);
printf("%d,%d,%d",a%b,a/b,c);
return 0;
}
#include
#include
int main()
{
float a, b, c;
float s, area;
printf("Input a,b,c:");
scanf("%f,%f,%f",&a,&b,&c);
if (a+b>c && b+c>a && a+c>b)
{
s = 1/2 * (a + b + c);
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("area=%.2f\n", area);
}
else
{
printf("It is not a triangle\n");
}
return 0;
}
#include
int main()
{
float data1, data2;
char op;
printf("Please enter the expression:");
scanf("%f %c%f", &data1, &op, &data2); /* %c前有一个空格 */
switch (op)
{
case '+':
printf("%f + %f = %f\n", data1, data2, data1 + data2);
break;
case '-':
printf("%f - %f = %f\n", data1, data2, data1 - data2);
break;
case '*':
printf("%f * %f = %f\n", data1, data2, data1 * data2);
break;
case '/':
printf("%f/%f = %f\n", data1, data2,data1/data2);
break;
default:
printf("Invalid operator!\n");
}
return 0;
}
#include
int main()
{
int x=1, y=0, a=0, b=0;
switch(x)
{
case 1:
switch(y)
{
case 0: a++;
case 1: b++;
}
case 2: a++;
b++;
}
printf("a=%d, b=%d\n", a, b) ;
return 0;
}
#include
#include
#include
#define EPS 1e-6
int main()
{
float a, b, c, disc, p, q;
printf("Please enter the coefficients a,b,c:");
scanf("%f,%f,%f", &a, &b, &c);
_________________________________ /* a=0时,输出"不是二次方程" */
{
printf("It is not a quadratic equation!\n");
exit(0); /* C标准库函数,用于终止整个程序的执行,强制返回操作系统 */
}
disc = b * b - 4 * a * c; /* 计算判别式 */
p = - b / (2 * a);
q = sqrt(fabs(disc)) / (2 * a);
if (fabs(disc) EPS) /* 判别式大于0时,输出两不等实根 */
{
printf("x1 = %.2f, x2 = %.2f\n", p+q, p-q);
}
else /* 判别式小于0时,输出两共轭复根 */
{
printf("x1 = %.2f+%.2fi, ", p, q);
printf("x2 = %.2f-%.2fi\n", p, q);
}
}
return 0;
}
#include
int main()
{
int a=5,b=4,c=3,d;
d=(a>b>c);
printf("%d\n",d);
return 0;
}
#include
int main()
{
int a=1,b=0;
switch (a)
{
case 1:
switch (b)
{
case 0: printf("**0**");break;
case 1: printf("**1**");break;
}
case 2: printf("**2**");break;
}
return 0;
}
#include
int main()
{
int a=3,b=4,c=5,d=2;
if(a>b)
{
if(b>c)
{
printf("%d",d++ +1);
}
else
{
printf("%d",++d +1);
}
}
printf("%d\n",d);
return 0;
}