U E D R , A S I H C RSS

데블스캠프2006/월요일/연습문제/for/주소영

No older revisions available

No older revisions available



== 데블스캠프2006/월요일/연습문제/for/주소영 ==
첫번째
~cpp
#include <iostream.h> 

void main() 
{ 
    int i, j, n; 

    cout << "수를 입력 하세요\n"; 
    cin >> n; 

    for (i=1; i<=n; i++){ 
        for( j=1; j<=i; j++){ 
            cout << "*"; 
        } 
        cout <<"\n"; 
    } 
    for ( i=1; i<=n; i++){ 
        for( j=1; j<=n-i; j++){ 
            cout << " "; 
        } 
            for( j=1; j<=i; j++){ 
            cout << "*"; 
        } 
        cout << "\n"; 
    } 
} 
두번째
~cpp
#include <iostream.h> 

void main() 
{ 
    int i,j,n; 
    j=1; 

    cout <<"20이하의 수를 입력 하세요\n"; 
    cin >> n; 

    if (n>20){ 
        cout <<"범위를 초과하였습니다\n"; 
    } 
    else{ 
        for (i=1; i<=n; i++){ 
            j*=i; 
        } 
        cout << j; 
    } 

} 

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:03
Processing time 0.0159 sec