Advertisement
DiegoTSemi

Untitled

Sep 30th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. void main ()
  6. {
  7. float vet[100];
  8. int soma;
  9. int a, b, i;
  10.  
  11. FILE *p;
  12. p = fopen("termos","a");
  13.  
  14. for (i=0;i<100;i++)
  15.  
  16. {
  17.  
  18. if (i>50)
  19. printf("Erro");
  20.  
  21.  
  22. else
  23. {
  24.  
  25.  
  26. fscanf(p,"%f \n", &vet[i]);
  27. a=vet[100-i];
  28. b=vet[i];
  29. soma = pow(b-a,3);
  30. printf("A soma é : %d \n", soma);
  31. }
  32.  
  33. }
  34.  
  35. fclose(p);
  36. system("PAUSE");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement