U E D R , A S I H C RSS

데블스캠프2006/월요일/연습문제/for/성우용

== 데블스캠프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; 
} 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0062 sec