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<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; 
     
    } 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:03
Processing time 0.0123 sec