IvoSilva

[PROG1] Ficha 5 | Exercício 5

Nov 17th, 2011
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. int dado ()
  3. {
  4.     return (rand() % 6 + 1) ;
  5. }
  6. int main ()
  7. {
  8.     int soma = 0 , n , i , num ;
  9.     printf ("Quantos lançamentos? ") ;
  10.     scanf ("%d" , &n) ;
  11.     for (i = 0 ; i < n ; i++) if (dado() == 6) soma++ ;
  12.     printf ("A face seis saiu %d vezes.\n" , soma) ;
  13.     return 0 ;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment