Skip to content

Instantly share code, notes, and snippets.

@Baekjoon
Created May 17, 2015 12:52
Show Gist options
  • Save Baekjoon/108b70d1d73e53dfda02 to your computer and use it in GitHub Desktop.
Save Baekjoon/108b70d1d73e53dfda02 to your computer and use it in GitHub Desktop.
7-2.cpp
#include <iostream>
using namespace std;
int main() {
// 1부터 10까지 출력하는 프로그램
int i = 1; // 초기값
while (i <= 10) { // 조건
cout << i << endl; // 해야할 일
i++; // 변경
}
// 10부터 1까지 출력하는 프로그램
i = 10;
while (i >= 1) {
cout << i << endl;
i--;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment