You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
386 B

#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int a[N], res[N];
int main() {
printf("a:");
for (int i = 0; i < N; ++i) {
a[i]=i;
printf("%2d ",a[i]);
}
printf("\nb:");
cout<<" "<<0<<" ";
for (int i = 1; i <N ; ++i) {
res[i]= a[i] + res[i - 1];
printf("%2d ", res[i]);
}
return 0;
}