Advertisement
Guest User

do while com scanf

a guest
Apr 23rd, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main ()
  4.  
  5. {
  6.  
  7.     int num, quad;
  8.    
  9.     do {
  10.         printf("Digite um número (0 para encerrar):\n");
  11.         scanf("%d", &num);
  12.         quad = num * num;
  13.         printf("O quadrado de %d = %d\n", num, quad);
  14.         scanf("%d", &num);
  15.     } while (num==0);
  16.  
  17.     return 0;
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement