Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. int main (){
  2.  
  3.     int i=0, num;
  4.     int  contador, tam, valor;
  5.  
  6.  
  7.     printf("Introduza o tamanho do vetor: ");
  8.     scanf("%d",&tam);
  9.  
  10.     for(i=0;i<tam;)
  11.     {
  12.         fflush(stdin);
  13.         printf("Introduza o valor de vetor[%d]: ",i++);
  14.         scanf("%d",&num);
  15.  
  16.         if(num==valor){
  17.             contador++;
  18.         }
  19.         return contador;
  20.     }
  21.         fflush(stdin);
  22.         printf("Qual o valor: ");
  23.         scanf("%d",&valor);
  24.  
  25.         printf("%d",contador);
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement