1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kozerog [31]
2 years ago
15

write a function that counts the number of times the value of y occurs in the first n values in array x. y is an integer variabl

e, x is an array of integers, and n is an integer variable. the name of the function must be count. the parameters must appear in the order of y, x, n.
Computers and Technology
1 answer:
mixer [17]2 years ago
7 0

Answer:

Following are the function of count:

void count(int y,int x[],int n) // function definition of count

{

int k,count=0;  // variable declaration

for(k=0;k<n;++k) // iterating over the loop

   {

   if(x[k]==y) //check the conndition number of times the value of y occurs

   {

   count++; // increment of count by 1

   }

   }

Explanation:

Following are the code in c language

#include <stdio.h> // header file  

void count(int y,int x[],int n) // function definition of count

{

int k,count=0;  // variable declaration

for(k=0;k<n;++k) // iterating over the loop

   {

   if(x[k]==y) //check the conndition number of times the value of y occurs

   {

   count++; // increment of count by 1

   }

   }

   printf(" the number of times the value of y occurs :%d",count); // display count value

   }

int main() // main method

{

   int x[100],y,n,k; // variable declarartion

   printf(" Enter the number of terms n :");

   scanf("%d",&n); // input the terms

   printf(" Enter the array x :");

   for(k=0;k<n;++k) // input array x

   {

   scanf("%d",&x[k]);

   }

   printf("Enter the value of y:");

   scanf("%d",&y);// input value y by user

    count(y,x,n); // calling function

   return 0;

}

In the given program we declared an array x ,variable  y and n respectively Input the array x ,y,n  by user after that we call the function count .In the count function we iterate the loop from o position to array length-1 and check the number of times the value of y occurs by using if statement  i.e  if(x[k]==y) if the condition of if block is true then we increment the count variable Otherwise not .Finally display the count variable which describe the number of count.

Output

Enter the number of terms n :5

1

2

2

56

5

Enter the value of y:2

the number of times the value of y occurs :2

Enter the number of terms n :5

1

2

3

56

5

Enter the value of y:26

the number of times the value of y occurs :0

You might be interested in
Drag each tile to the correct box.
V125BC [204]

Answer:

Creates order and harmony → <em>color</em>

Creates an emotional impact → <em>texture</em>

Brings a feeling of depth to a design →<em> form</em>

Draws or minimizes attention → <em>space</em>

Divides space and redirects the eye → <em>shape</em>

Explanation:

The visual element that creates order and harmony is <em>color</em>

Color can be used to create visible patterns that can be recognized as being in harmony or disagreement

The visual element that creates emotional impact is <em>texture</em>

Texture can be used to convey either the emotions of the object or the artist

The visual element that brings a feeling of depth to a design is<em> form</em>

Form is used to present a 3-D appearance of an art, and therefore, it is used to show depth of a 2-D drawing

The visual element that draws or minimizes attention is <em>space</em>

The arrangement, location, and size of the space occupied by an object can be used to draw or minimize attention

The visual element that divides space and redirects the eye is <em>shape</em>

Shape is used to divide space into areas easily recognizable by the eye

5 0
2 years ago
What type of natural disaster stuck haiti in 2010 and killed more than 200,000 people
Aleonysh [2.5K]

Answer:

Earthquake

Explanation:

Around 3 million people were affected by this disaster and it was the most devastating natural disaster ever experienced in Haiti. Roughly 250,000 lives were lost and 300,000 people were injured.

3 0
3 years ago
Read 2 more answers
Es el conjunto de manifestaciones materiales, intelectuales y espirituales que distinguen a un pueblo a)Civilización b)Cultura c
GREYUIT [131]

Answer:

a)Civilización

Explanation:

3 0
2 years ago
The prepaid tuition plan covers
rusak2 [61]
Hey there!

A prepaid tuition plan is a plan that allows you to pay the current rate of tuition now (say, years in advance), even if it's much higher than the time when the payment for tuition would actually be paid. This plan is great for anyone who wants to pay a lower price for high–cost education now (even if their kid isn't college age yet) and not have to worry about economic standing or inflation in the future that could drive the tuition prices up. 

The plan only covers tuition and other similar fees. You can not purchase books or room and board with it in advance. So, your answer should be: C. Tuition and Fees. 

Hope this helped you out! :-)
8 0
3 years ago
Read 2 more answers
The difference between Return key and word Wrap
saveliy_v [14]
The enter key is used when we want to go directly to the next line while writing whereas through word wrap the cursor automatically shifts to the next line when the word limit for a particular line is exceeded
3 0
3 years ago
Other questions:
  • Find a, b, and c<br> A a=4 square root of 6 b= 8 square root of 2 ; c= 4 square root of 2
    12·1 answer
  • Recall that through either photographic or computer technology, researchers can make a composite (or "averaged") face out of any
    11·1 answer
  • It is illegal to have __________ emergency lights on your vehicle.
    6·2 answers
  • Which type of computer is the best? laptop, tablet, or desktop
    15·2 answers
  • The central processing unit (CPU) processes the data in a computer systenpical data processing includes:
    10·1 answer
  • design aDesign a queue abstract data type for float elements in a language that you know, including operations for enqueue, dequ
    10·1 answer
  • Favorite color should it be stored why?or why not?<br>​
    6·1 answer
  • A write the result P*=++j where j is 24
    5·1 answer
  • A keyboard would be considered what 2 things
    11·1 answer
  • What does the asterisk (*) after select tell the database to do in this query?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!