[정올] Language Coder_반복제어문2_자가진단3_code543 (C/Python)

두비니

·

2020. 3. 20. 03:28

 

<C>

#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	for (int a = 2; a <= n; a+=2) {
		printf("%d ", a);
	}
	return 0;
} 

 

 

<Python>

n = int(input())

for i in range(1, n+1):
    if i % 2 == 0:
        print(i, end=' ')