Advertisement
nguyenhappy92

1.2.3+ 2.3.4 + 3.4.5 +...+ n(n +1)(n + 2)

Oct 22nd, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. // khai bao cac ham thu vien neu co
  2. #include<stdio.h>
  3. #include<conio.h>
  4.  
  5. void main()
  6. {
  7. int n;
  8. scanf("%d",&n);
  9. long s=0;
  10. for(int i=1;i<=n;i++)
  11. {
  12. s=s+ (i*(i+1)*(i+2));
  13. }
  14. printf("%ld",s);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement