[백준] 2083번

park jinwoo·2022년 12월 27일
0

백준

목록 보기
70/94

https://www.acmicpc.net/problem/2083

나이가 17세보다 많거나, 몸무게가 80kg 이상이면 성인부이다. 그 밖에는 모두 청소년부이다. 클럽 회원들을 올바르게 분류하라.

<script>
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

typedef struct {
	char name[10];
	int age;
	int weight;
} person;
// name[10], age, weight를 가지는 person구조체를 정의한다.

int main()
{
	while (1) {
		person a;

		scanf("%s %d %d", a.name, &a.age, &a.weight);

		if (a.name[0] == '#' && a.age == 0 && a.weight == 0) {
			break;
		// 입력값에 따라 끝나는 조건문
		}
		else if (a.age > 17 || a.weight >= 80) {
			printf("%s Senior\n", a.name);
		// 나이가 17세보다 많거나, 몸무게가 80이상일시 Senior를 이름과 함께 출력한다.
		}
		else {
			printf("%s Junior\n", a.name);
		}
	}

	return 0;
}
</script>

0개의 댓글