데블스캠프2006/월요일/연습문제/for/임다찬 ¶
첫번째
~cpp #include <iostream> using namespace std; int main(){ int i,j,k,l; for(i = 0; i < 5; i++){ for(j = 0; j <= i; j++){ cout << "*"; } for(k = 0; k < 5; k++){ cout << " "; } for(l = 0 ; l < 5-i ; l++){ cout << "*"; } cout << endl; } cout << endl; return 0; }두번째
~cpp #include <iostream> using namespace std; int factorial(int n){ if(n<=1){ return 1; } else{ return n*factorial(n-1); } } int main(){ int number; cin >> number; cout << factorial(number) << endl; return 0; }