No older revisions available
No older revisions available
== 데블스캠프2006/월요일/연습문제/for/성우용 ==
첫번째
첫번째
~cpp #include<iostream> using namespace std; int main() { int i,j; for(i=0;i<5;i++) { for(j=0;j<i+1;j++) { cout<<"*"; } cout<<"\n"; } for(i=0;i<5;i++) { for (j=5;j>i;j--) { cout<<"*"; } cout<<"\n"; } return 0; }두번째
~cpp #include <iostream> using namespace std; int main() { int num, fac = 1; cout << "숫자를 입력하세요."; cin >> num; if (num > 10) { cout << "error"; cout << "\n"; } else { for (; num > 0; num--) { fac *= num; } cout << fac; cout << "\n"; } return 0; }