题目描述
有一只蚂蚁在一个圆上爬行,圆心坐标是(0,0),半径r=4.5,任意输入蚂蚁在圆上的坐标(x,y),判断这只蚂蚁是在圆内,圆周上,还是在圆外。
输入
两个浮点数x,y
输出
如果在圆内,输出in
如果在圆外,输出out
如果在圆上,输出on
样例输入
1.0 1.0
样例输出
in
代码:
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, y,c;
scanf("%lf %lf", &x, &y);
c = sqrt(pow(x, 2) + pow(y, 2));
if (c==4.5)printf("on");
else if (c>4.5)printf("out");
else if (c<4.5")printf("in");
return 0;
}