Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab5_356

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-10T18:49:50Z

Updated

2018-12-10T18:49:50Z

#include <iostream>
using namespace std;

int main() {
    const int n = 10 ; 
    int a[n];
    a[0] = 1 ;
    cout << 1 << " - " << a[0] << endl ; 
    int i = 1 ;
    int sum = 1 ; 
    do {
    a[i] = a[i-1] + 4;
    sum += a[i];
    cout << i+1 << " - " << a[i] << endl ; 
    i++;
    
    
        
    } while (i<10);
    cout << sum << endl ; 
    return 0;
}
INFO