데블스캠프2006/월요일/연습문제/for/김준석

첫번째
~cpp
#include<iostream> 
using namespace std; 

void main(){ 

    int i,j; 

    for(i=0;i<5;i++){ 
        for(j=0;j<=i;j++) 
            cout << "*"; 
        cout << endl; 
    } 

    cout << endl; 

    for(i=0;i<5;i++){ 
        for(j=0;j<=i;j++) 
            cout << " "; 
        for(j=0;j<5-i;j++) 
            cout << "*"; 
     
        cout << endl; 
} 
} 
두번째
~cpp
#include<iostream> 
using namespace std; 

void main(){ 

    int i; 
    int sum=1; 

    cout << "10이하의 숫자를 입력해 주세요 " << endl; 
    cin >> i; 

    for(;i>0;){ 

        sum *= i--; 
    } 

    cout << sum << endl; 
} 

Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2006/월요일/연습문제/for/김준석
last modified 2021-02-07 05:29:02