SHARE
TWEET

Untitled

a guest May 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main(){
  3.     int n,i;
  4.     int s=0, p=1;
  5.     printf("S(n)=1+1.2+1.2.3+...+1.2.3...n\n");
  6.     do{
  7.         printf("n = ");
  8.         scanf("%d",&n);
  9.     } while ( n<=0);
  10.     for (i=1; i<=n; i++){
  11.         p*=i;
  12.         s+=p;
  13.     }
  14.     printf("S(%d) = %d",n,s);
  15.    
  16.     return 0;
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top