데블스캠프2006/월요일/연습문제/for/이장길 ¶
첫번째
~cpp #include <iostream.h> int main(void) { int a,b; for(a=1;a<6;a++){ for(b=0;b<a;b++){ cout<<"*"; } cout<<endl; } cout<<endl; for(a=1;a<6;a++){ for(b=0;b<a;b++){ cout<<" "; } for(b=0;b<6-a;b++){ cout<<"*"; } cout<<endl; } return 0; }두번째
~cpp #include <iostream.h> int main(void) { int a,i,f=1; cout<<"숫자를 입력하세요."; cin>>a; for(i=1;i<=a;i++){ f *=i; } cout<<f; return 0; }