1
#include<stdio.h>
int main()
{
float a,b;
printf("输入华氏温度f=");
scanf("%f",&b);
a=5.0/9*(b-32);
printf("输出摄氏温度c=%.2f\n",a);
return 0;
}
2
#include<stdio.h>
int main()
{
int x,y;
printf("输入x的值:");
scanf("%d",&x);
if(x<5){
x>0?(y=x):(y=0-x);
}
if(x>=5&& x<15){
y=x*x+6;
}
if(x>=15){
y=x-10;
}
printf("y=%d",y);
return 0;
}
3
#include<stdio.h>
#define sl 5
int main()
{
int create[sl];
int prjo;
int one;
int two;
int three;
printf("输入实数:\n");
for(int x=0;x<sl;x++){
printf("输入第%d个实数:",x+1);
scanf("%d",&create[x]);
}
for(int y=0;y<sl;y++){
if(create[y]==0){
++three;
}
create[y]>0?++one:++two;
}
printf("正数:%d\n负数:%d\n等于零:%d",one,two,three);
return 0;
}
#include<stdio.h>
#define sl 5
int main()
{
int max=0;
for(int x=1;x<100;x=x+2){
printf("%d\n",x);
max=max+x;
}
printf("max=%d",max);
return 0;
}
5
#include<stdio.h>
#define sl 5
int main()
{
int max=1;
for(int x=1;x<11;x++){
max=max*x;
}
printf("%d",max);
return 0;
}