008

2004_1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;
int i,j,f,a[9],n=8;
int main(){
    for (int i = 1; i <=n; i++){
        f=i%2;
        if(f==0)a[i]=0;
        else a[i]=1;
        for (int j = 1; j <=i; j++)
            if(f==0)a[i]=a[i]+j;
            else a[i]=a[i]*j;        
    }
    for (int i = 1; i <=n; i++)
       printf("%5d",a[i]);
return 0;    
}
Scroll to Top