几道基础的C语言题

1.设计一个简单的计算器程序,用户输入运算数和四则运算符(+,-,*,/),输出计算的结果。(除法为整除)
2.根据输入的X的值求Y的值,当X>0且X≠2时,Y=(X+1)/(X-2);当X=0或X=2时,Y=0;当X<0时,Y=(X+1)/(X-2)
3.编写程序,从键盘输入学生成绩,输出对应的等级(100分为A,90-99为B,80-89为C,70-79为D,60-69为E,小于60为F)
1.
#include <stdio.h>
int main(void)
{
double number1,number2;
char operation=0;
printf("\n请输入计算式回车结束\n");
scanf("%lf %c %lf",&number1,&operation,&number2);
switch(operation)
{
case '+':
printf("=%lf\n",number1+number2);
break;

case '-':
printf("=%lf\n",number1-number2);
break;

case '*':
printf("=%lf\n",number1*number2);
break;

case '/':
if(number2==0)
printf("\n\n错误:除数不能为0!");
else
printf("=%lf",number1/number2);
break;

default:
printf("\n\n非法操作\n");
}
return 0;
}
------------------------------------------------------------------------------------------------------------------
2.
#include <stdio.h>
int main(void)
{
double x,y;
printf("请输入x值:");
scanf("%lf",&x);
if((x>0&&x!=2)||x<0)
printf("y=%lf",(x+1)/(x-2));
else
printf("y=0");
return 0;
}
-----------------------------------------------------------------------------------------------------------------------
3.
#include <stdio.h>
int main(void)
{
int grade;
printf("\n请输入学羡野虚生成绩:");
scanf("%d",&grade);
if(grade==100)
printf("A"脊模);
else if(grade>=90&&grade<=99)
printf("B");
else if(grade>=80&&grade<=89)
printf("C");
else if(grade>=70&&grade<=79)
printf("D");
else if(grade>=60&&grade<兄燃=69)
printf("E");
else if(grade>=0&&grade<60)
printf("F");
else
printf("非法输入");

return 0;
}
1.#include <stdio.h>
main()
{
float x,y;
char op;
double z;
scanf("散纤%f%f%c",&x,&y,&op);
switch ()
{
case '+':z=x+y;break ;
case '-':z=x-y;break ;
case '*':z=x*y;break ;
case '/'咐掘饥:z=x/y;break ;
default:printf("operator error");
}
printf("衡返%f%c%f=%f",x,op,y,z);
}
2.