U E D R , A S I H C RSS

데블스캠프2006/월요일/연습문제/for/이경록

데블스캠프2006/월요일/연습문제/for/이경록

첫번째
~cpp
#include<iostream.h> 

int main(void) 
{ 
    int a,b; 

        for(a=1;a<=5;a++){ 
            for(b=0;b<a;b++){ 
                cout<<"*"; 
            } 
            cout<<endl; 

        } 
        for(a=1;a<=5;a++){ 
            for(b=4;b>5-a;b--){ 
                cout<<" "; 

            } 
            for(b=1;b<=6-a;b++){ 
                cout<<"*"; 
            } 
            cout<<endl; 
        } 
         

    return 0; 
} 

두번째
~cpp
#include<iostream.h> 

int main(void) 
{ 
    int a,b; 
    int result=1; 
     

    cout << "10 이하의 자연수를 입력해 주세요\n"; 
    cin >> a; 

    if(a>10) { 
        cout<<"잘못 입력 하셨습니다.\n"; 
    } 
    else{ 
        for(b=1;b<=a;b++){ 
            result = result * b; 
        } 
        cout<<result; 
    } 
    return 0; 
} 

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