Advertisement
ricardorichsn

nac_3_exer2

May 23rd, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<math.h>
  4.  
  5. int main()
  6. {
  7.     float x, xf, t, y;
  8.     printf("Digite o valor inicial: ");
  9.     scanf("%f", &x);
  10.     printf("Digite o valor final: ");
  11.     scanf("%f", &xf);
  12.     printf("Digite o intervalo: ");
  13.     scanf("%f", &t)
  14.     if(x>xf && t>0)
  15.     printf("\n\nValor inicial deve ser menor do que Valor final!!\n");
  16.     else
  17.     {
  18.         for( ; x <= xf ; x+=t)
  19.         {
  20.             y = pow(x,2) + 2*x + 1;
  21.             printf("valor Y: %f", y);
  22.             printf(" e o valor X: %f\n\n", x);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement