帮帮忙!c语言的问题!

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:09:20
1.编程设计一个简单的计数器程序,要求根据用户从键盘输入的表达式:操作数1 运算符 操作数2,计算表达式的值。指定运算为+,-,*,/。
例如输入:2.5+3
输出为:2.500000+3.000000=5.500000
例如输入:5/2
输出为:5.000000/2.000000=2.500000

2.一圆塔高10米,其圆心坐标为(0,0),其半径为2,编程求任一坐标点(x,y)的高度是多少?

3.编写猜数程序,程序中预先给定某个整数,从键盘反复输入整数进行猜数,每次输入数未猜中时,提示输入数过大或过小。猜中时显示猜的次数,最多允许猜20次。

4.编写程序,从键盘输入一个正整数,计算该数的各个位数字之和,并显示结果。例如输入3257,结果为17。

一题楼上答对了,就不重复了。
题二:
# include <stdio.h>
# include <math.h>

main()
{
float x,y,h;
printf("Please input the coordinates:\nAttention:the numble shouldn't more than 2.\n");
scanf("%f %f",&x,&y);
printf("height=%4.2f\n",(1-sqrt(x*x+y*y)/2)*5);
getch();
}
题三:
# include <stdio.h>
# define N 23
main()
{
int t=0,x,i=1;
printf("Please guess the numble:\n");
scanf("%d",&x);
do
{if(x>N)
{printf("Bigger than the given.Try again:\n");
scanf("%d",&x);}
else
if(x<N)
{printf("Smaller than the given.Try again:\n");
scanf("%d",&x);}
else
{
printf("Congratulations!\n");
t=1;
break;
}
}
while(i