SHARE
TWEET

L4.28

GIEA Mar 26th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int S, X, contador, fatorial=1, multiplicador=1;
  7.     printf("Digite o valor de X: ");
  8.     scanf("%d",&X);
  9.     S=X;
  10.     for(contador=1;contador>=1;contador++)
  11.     {
  12.         if(multiplicador==19)
  13.         {
  14.             fatorial*=multiplicador;
  15.             S-=X/fatorial;
  16.             printf("S = %d",S);
  17.             return 0;
  18.         }
  19.         fatorial*=multiplicador;
  20.         if(contador%2!=0)
  21.         {
  22.             S-=X/fatorial;
  23.             multiplicador++;
  24.         }
  25.         else
  26.         {
  27.             S+=X/fatorial;
  28.             multiplicador++;
  29.         }
  30. }
  31. }
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