nikolas_serafini

Lista 3 - Exercício 63

Jun 17th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int position;
  7.     float firstElement,ratio,progression;
  8.  
  9.     printf("Entre com o primeiro termo da P.A :\n");
  10.     scanf("%f",&firstElement);
  11.     printf("Entre com a razao :\n");
  12.     scanf("%f",&ratio);
  13.     printf("Entre com a posicao desejada :\n");
  14.     scanf("%d",&position);
  15.  
  16.     progression = firstElement*pow(ratio,position-1);
  17.  
  18.     printf("an = %f\n",progression);
  19.     return 0;
  20. }
  21.  
  22. /*O exercício pede uma P.A, mas dá fórmula de P.G. Não faz diferença, nenhum deles utiliza for
  23. e não deveria estar na lista.*/
Advertisement
Add Comment
Please, Sign In to add comment