https://www.acmicpc.net/problem/2741
2741번: N 찍기
자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
www.acmicpc.net
C언어
#include<stdio.h>
int main(){
int N, i;
scanf("%d",&N);
for(i=1; i<=N; i++){
printf("%d\n",i);
}
return 0;
}
파이썬
N = int(input())
for i in range(N):
print(i+1)
'프로그래밍 > 백준' 카테고리의 다른 글
백준 11021번: A+B - 7 (C언어/파이썬) (0) | 2020.02.14 |
---|---|
백준 2742번: 기찍 N (C언어) (0) | 2020.02.14 |
백준 8393번: 합 (C언어) (0) | 2020.01.21 |
백준 10950번: A+B - 3 / 15552번: 빠른 A+B (C언어/파이썬) (0) | 2020.01.21 |
백준 2739번: 구구단 (C언어/파이썬) (0) | 2020.01.21 |