Advertisement
gtw7375

Fatorial com vetor - c

Oct 9th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. main(){
  2.  
  3.        int vet[10], vetb[10], x, i, fatorial;
  4.        
  5.        
  6.            for(x=0; x<10; x++){
  7.                     printf("Informe um numero:");
  8.                     scanf("%d", &vet[x]);
  9.            }
  10.            
  11.            for(x=0; x<10; x++){
  12.                     fatorial=1;
  13.                     for(i=1; i<=vet[x]; i++){
  14.                              fatorial *= i;
  15.                     }                    
  16.            vetb[x]=fatorial;
  17.            }
  18.            
  19.            for(i=0;i<10; i++){
  20.                          printf("Numero: %d, fatorial: %d\n", vet[i], vetb[i]);
  21.            }
  22.        
  23.         getch();
  24.        
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement