데블스캠프2006/월요일/연습문제/for/윤성준 ¶
첫번재
~cpp #include <iostream> using namespace std; int main (void) { int p, n; for (p = 1; p <= 5; p++) { for (n = 1; n <= p; n++) { cout << "*"; } cout << endl; } cout << endl; for (p = 1; p <= 5; p++) { for (n = 1; n <= 6-p ; n++) { cout << "*"; } cout << endl; } return 0; }두번째
~cpp #include <iostream> using namespace std; int main (void) { int f, factn, res = 1; cin >> f; if (f <= 10) { for (factn = 1; factn <= f; factn++) { res *= factn; } cout << res; } return 0; }