ramontricolor12

LISTA 02 - exercício 54

Jun 3rd, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int x, resul;
  7.  
  8.     printf("\nInforme o valor de x: ");
  9.     scanf("%d", &x);
  10.  
  11.     if(x <= 1)
  12.         resul = 1;
  13.     else if(x > 1 && x <= 2)
  14.         resul = 2;
  15.     else if(x > 2 && x <= 3)
  16.         resul = pow(x,2);
  17.     else
  18.         resul = pow(x,3);
  19.  
  20.     printf("\nO resultado e: %d\n", resul);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment