데블스캠프2006/월요일/연습문제/for/정승희 ¶
for문 1번
~cpp #include <iostream> using namespace std; int main() { for(int i=0;i<5;i++) { for(int j=0;j<=i;j++) cout << "*"; cout <<"\n"; } for(i=0;i<5;i++) { for(int j=0;j<=i;j++) cout << " "; for(j=5;j>i;j--) cout << "*"; cout<<"\n"; } return 0; }
for문 2번
~cpp #include <iostream> using namespace std; int main() { /////////////!////////////////// int n,s=1; cin >> n; if(n<10){ for(int i=1;i<=n;i++) s=i*s; } cout << s; return 0; }