Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <iostream>
- using namespace std;
- // Dado um inteiro n, encontre a soma da série 1+(2*3)+(4*5*6)+...+ n.
- int main() {
- int i, n, t=0, soma=0, resp=0;
- cout<< "Entre com um valor n inteiro: ";
- cin>> n;
- for (i = 1; i <= n; i++) {
- t += i;
- soma += (t*i);
- }
- resp=soma;
- cout<<"A soma da sequencia e: "<< soma;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement