Quick actions

cmd+k|ctrl+k

Navigation

Languages

LAB5_76

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-10T17:25:50Z

Updated

2018-12-10T17:25:50Z

#include <iostream>
using namespace std;
#include <cmath>
int main() {
    int n ; 
    cout << "Enter n" << endl ; 
    
    cin >> n ; 
    
    cout << "===================a==================" << endl ; 
    
    double a , x; 
    
    for (size_t i = 1 ; i <= n ; i++){
        for (size_t j = 1 ; j <= i ; j++){
            x = x + sin(j);
        }
        a = a + 1/x;
    }
    cout << "\t\t" << a << endl ;
    
    cout << "===================b==================" << endl ; 
    
    a = 0 ; x = 0 ; 
    
    double x1 ;
    
    for (size_t i = 1 ; i <= n ; i++){
        for (size_t j = 1 ; j <= i ; j++){
            x = x + sin(j);
            x1 = x1 + cos(j);
        }
        a = a + x1/x;
    }
    
    cout << "\t\t" << a << endl ; 
    
    
    
    return 0;
}
INFO