#include <iostream>
#include <math.h>
using namespace std;
int factorial(int n)
{
if(n > 1)
return n * factorial(n - 1);
else
return 1;
}
int main()
double sum=0;
double sumSin=0;
for(int k=1; k<=10; k++ ){
for(int n=1; n<=k; n++){
sumSin+=sin(k*n);
sum+=sumSin/factorial(k);
cout << sum << endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <math.h>
using namespace std;
int factorial(int n)
{
if(n > 1)
return n * factorial(n - 1);
else
return 1;
}
int main()
{
double sum=0;
double sumSin=0;
for(int k=1; k<=10; k++ ){
for(int n=1; n<=k; n++){
sumSin+=sin(k*n);
}
sum+=sumSin/factorial(k);
}
cout << sum << endl;
return 0;
}