Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Frequency

printf("Enter n: ");
  scanf("%d", &n);
  
  int elem[n];
  
  printf("Enter elements: 
");
  
  for(x=0; x<n; x++){
  
  scanf("%d", &elem[x]);
  }
  
  int y;
  
  printf("Enter y: ");
  scanf("%d",&y);
  
  for(z=0; z<n; z++){
  
  		if(elem[z]==y){
  			count++;
		  }
  
  }
      printf("FREQUENCY: %d",count);
Source by app.codechum.com #
 
PREVIOUS NEXT
Tagged: #Frequency
ADD COMMENT
Topic
Name
6+3 =