본문 바로가기
C/c언어 수업

숫자 세개 입력받은 뒤 홀수 짝수

by sj0020 2020. 7. 31.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

void main(void) {
	int num1 = 0;
	int num2 = 0;
	int num3 = 0;

	printf("enter the num1:");
	scanf("%d", &num1);
	printf("enter the num2:");
	scanf("%d", &num2);
	printf("enter the num3:");
	scanf("%d", &num3);

	if (num1 % 2 == 0) {
		printf("num1 is even number.\n");
	}
	else {
		printf("num1 is odd number.\n");
	}

	if (num2 % 2 == 0) {
		printf("num2 is even number.\n");
	}
	else {
		printf("num2 is odd number.\n");
	}

	if (num3 % 2 == 0) {
		printf("num3 is even number.\n");
	}
	else {
		printf("num3 is odd number.\n");
	}

}

'C > c언어 수업' 카테고리의 다른 글

동전교환기  (0) 2020.07.31
switch 숫자 두개 입력받은 뒤 사칙연산 계산기 int, double  (0) 2020.07.31
switch  (0) 2020.07.31
if 성적표 합.평균.grade ABCDE  (0) 2020.07.31
숫자 두개 입력받은 후 계산기  (0) 2020.07.31