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]
3 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]3 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
2
Crazy boy [7]

If any mistake was made using this type of primitive programming, the entire program of punch cards had to be re punched again. The correct option is A.

<h3>What is punch card?</h3>

A punch card is a card on which data is able to be recorded in the form of punched holes.

Whenever a mistake is done, the punched card is scrapped and made anew one for same programming.

Thus, if any mistake was made using this type of primitive programming. The entire program of punch cards had to be re punched again. The correct option is A.

Learn more about punch card.

brainly.com/question/27476988

#SPJ1

4 0
2 years ago
This motherboard already has 1GB of RAM installed in the DIMM1 slot. The customerwould like to upgrade to 4GB total memory, use
Luden [163]

Answer:

The two phases to the context of this discussion are listed follows.

Explanation:

  • <u>Solution 1</u>: Delete 1 GB of current RAM as well as install another DIMM0 Chan A slot through one 2 GB of double-channel RAM. (thinkable unless the 2 GB RAM is provided by the motherboard in what seems like a DIMM0 Chan A slot)  
  • <u>Solution 2</u>: whether there's an unused or blank slot, perhaps one 1 GB dual-channel Ram could be mounted in some other slot at around the same speed or frequency.  

It's quite safer to mount memory with appropriate frequencies across both situations.

6 0
3 years ago
Choose the two main capabilities involved in visual literacy
andreyandreev [35.5K]

The two main capabilities involved in visual literacy are:

<span>1)   </span>Communication through use of visual elements.

<span>2)   </span>Interpret meaning from visual elements.

<span>Visual literacy is the capacity to decipher, arrange, and make significance from data displayed as a picture, broadening the importance of proficiency, which means understanding of a composed or printed content.</span>

7 0
3 years ago
A numbered list is best suited for steps that need to be done in _______________________ . [Create Bulleted and Numbered Lists]
kap26 [50]

Answer:

Order.

Explanation:

Microsoft Word refers to a word processing software application or program developed by Microsoft Inc. to enable its users to type, format and save text-based documents.

In Microsoft Word 2019, the users are availed with the ability to edit the word document in the following view type;

I. View Mode.

II. Print Mode.

III. Drift Layout.

A numbered list can be defined as a list of items that are ordered numerically or sorted sequentially.

A numbered list is best suited for steps that need to be done in order, usually in an ascending order. Thus, a numbered list is an ordered list that starts from 1.

To create a numbered list in Microsoft Word, you should press 1 followed by a period, leave a space, type a text and then press the enter button.

5 0
3 years ago
Between the div tags below, type the code for a link to the second.html page. Use "Go to the Second Page" as the link text
marysya [2.9K]

A code for a link to the second.html page is given by <div>Go to the Second Page</div>.

<h3>What is a div tag?</h3>

A div tag is an abbreviation for division tag and it can be defined as a type of HTML tag that is designed and developed to break (divide) a webpage into several elements with their respective layout attributes.

In this scenario, a code for a link to the second.html page is given by <div>Go to the Second Page</div>.

<u>Note:</u> "Go to the Second Page" serves as the link text.

Read more on div tag here: brainly.com/question/14075748

#SPJ1

4 0
2 years ago
Other questions:
  • An online conference room reservation system lets a user reserve rooms. The user is required to enter contact information and re
    13·1 answer
  • A broadband router is used to do which of the following? run the programs on a computer locate lost files on a computer manage a
    6·1 answer
  • a mobile base in an urban environment has the power of 15 microW at 175 m. If the propagation follows an inverse cube power law,
    11·1 answer
  • What does DOS stand for?
    15·1 answer
  • Which best describes the Help feature of Word?
    13·2 answers
  • Usually written in block style with body text aligned along the left margin
    5·2 answers
  • Given the following class definition and the variable declaration:
    11·1 answer
  • The TCP congestion control measure techniques fall into two categories: retransmission timer management and ________ management
    13·1 answer
  • Whats the answer :)?<br>i will give brainslist​
    11·1 answer
  • Gina, an IT professional, noticed that the servers were running very slowly. She evaluated the system and made a recommendation
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!