반응형
#include<stdio.h>
struct point {float x; float y;};
point f(point p, point q)
{
point t;
t.x = (p.x + q.x)/2;
t.y = (p.y + q.y)/2;
return t;
}
int main(){
point a,b,t;
scanf("%f %f", &a.x, &a.y);
scanf("%f %f", &b.x, &b.y);
t = f(a,b);
printf("%.3f %.3f\n", t.x, t.y);
}
/*
3.1 1.4
4.1 1.5
3.600 1.450
--------------------------------
Process exited after 10.97 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형
'2019~2020 > 정보 과학' 카테고리의 다른 글
별찍기 (0) | 2019.08.23 |
---|---|
switch-case와 while문, 함수를 사용한 사칙연산 계산기 (0) | 2019.08.21 |
별찍기 개수 만큼 출력 (0) | 2019.08.19 |
택시 거리 계산하기 (0) | 2019.06.19 |
성적 입력하기 (0) | 2019.06.19 |