Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <locale.h>
- #include <time.h>
- calculo(int *,int);
- int main (void){
- int i,num[20],oc=0,resposta=0;
- srand(time(NULL));
- for(i=1;i<20;i++){
- num[i]=1+(rand()%15);
- //printf("num: %d\n",num[i]);}
- printf("Digite o Numero de Ocorrência: ");
- scanf("%i",&oc);
- resposta=calculo(num,oc);
- printf("Resposta: %i",resposta);
- getch();
- return 0;}
- int calculo(int *numero,int flag){
- int i,resp=0;
- for(i=1;i<20;i++){
- if(numero[i]==flag)
- resp++;}
- return resp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement