Write a program that will read in id numbers and place them in an array.The array is dynamically allocated large enough to hold the number of id numbers given by the user. The program will then input an id and call a function to search for that id in the array. It will print whether the id is in the array or not.

Answers

Answer 1

Answer:

#include <stdio.h>

#include <stdlib.h>

int main() {

  int n, i, *p, s;

  scanf("%d", n);

  p = (int*) malloc(n * sizeof(int));

  if(p == NULL) {

     printf("\nError! memory not allocated.");

     exit(0);

  }

  printf("\nEnter elements of array : ");

  for(i = 0; i < n; ++i) {

     scanf("%d", p + i);  

  }

  scanf("Enter Id to be searched: %d", s);

  for(j = 0; j < n; ++j) {

     if (s == *(p+j)){

         printf("ID number is in the array at position %d", j);

     }else{

         printf("Error: ID number does not exist.");

     }  

  }

  return 0;

Explanation:

The C program source code inputs integer values to dynamic array size, and the search variable is looked for in the array using a for loop. If the search term exists, then the index position is printed on the screen, else an error message is displayed on the screen.


Related Questions

JAVA Write code which prints every number from 1 to 20 a number of times equal to the number itself (e.g. one 1, two 2's...). Every individual number printed should be separated by a space, and there should be a new line each time the number changes. You should use nested loops to produce your output (it will result in far less code).

Partial sample run:

1
2 2
3 3 3
........

Answers

I've included my code in the picture below. Best of luck.

In cell D15, enter a formula using a counting function to count the number of cells in the Billable? column

Answers

The formula that could be entered as a counting function to count the number of cells would be COUNTA.

What formula can be used in cell D15?

If you want to count the number of cells that are not empty in the Billable column, you can go to cell D15 and type in =COUNTA(.

After that, you highlight the entire Billable column from D2 to D14 and then close the formula and press enter. It will return the number of cells that are not empty.

Find out more on the spreadsheet functions at https://brainly.com/question/1395170.

Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be the bit sequence that actually gets transmitted?

Answers

Let the message be M : 1001 0001   and the generator function is G : 1001

Solution :

CRC sender

                                               

1001     | 1001  0001  000

             1001                            

            0000  0001            

                        1000

                       1001            

                        0001  000

                                 1 001  

                                 0001

Here the generator is 4 bit - 1, so we have to take three 0's which will be replaced by reminder before sending to received--

eg    1001  0001  001    

Now CRC receiver

                                                   

1001         | 1001    0001   001

                1001                          

                 0000 0001

                            1001                  

                            1000

                           1001              

                            0001  001

                           0001  001      

                                   0000

No error

Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
diagram be the best choice to represent her information?
O It is the best way to show how something functions.
O It is the easiest way to present complex scientific data.
O It is the best way to show how much energy can be produced.
O It is the easiest way to present large amounts of numerical data.

Answers

A.) it the best way to show how something functions

Answer:

a

Explanation:

Question #2
Multiple Choice
What is the next line?
>>> my Tuple = [10, 20, 50, 20, 20, 60]
>>> my Tuple.index(50)
O 4
O 2
O 3
O 1

Answers

Answer:

The index of 50 is 2.

Explanation:

Index method is sued to return the index of a number or element in a list.

The syntax of using the index method when we have to find the index of a specific element is:

>>>ListName.Index(element)

It has to be remembered that the indexes of a list start from zero.

In the given statements, first a list is created with elements and the second statement will get the index of 50 in the list.

Hence,

The index of 50 is 2.

The next line can be written to display the index of 50 as:

print("The index of 50 is:",my Tuple.index(50))

What missing function will return the index of 7 in the list?

Answers

Answer:

The answer is: index function and it will be used in the following manner:

>>> myList.index(7)

Explanation:

List is one of the 4 built-in data types that are present in Python language. Lists are used to store same type of values. Indexes are used to access elements of lists in Python.

Various operations can be performed on the lists.

In the given question, we have to write the function that can be used to find the index of an element in the list.

Index function is sued for this purpose.

The syntax for index function is:

list_name.index(element)

So for the given list, to find the index of 7, the function will be written as:

>>> myList.index(7)

Hence,

The answer is: index function and it will be used in the following manner:

>>> myList.index(7)

Answer:

Index

Explanation:

Edge 2020

what is the value of the variable double dNum=14/5?

Answers

Answer:

2.0

Explanation:

In the case where the result is cast to a double, the answer evaluated to an in type (2) then was cast to a double which gives you 2.0.

This diagram shows who is responsible in preventing cyberbullying.
A flowchart.
Top box is labeled Cyberbullying can be prevented!
A line leads to two boxes labeled Parents/guardians, Schools.
Lines lead from Schools to boxes labeled Administrators, Teachers, Students.
Based on the diagram, which explains the most effective way to stop cyberbullying?

Answers

Answer:

Parents monitor home computer use, administrators secure school computers, and students report cyberbullying.

Explanation:

this should be right

Lucy completed her PowerPoint presentation and showed it to her teacher to review. Lucy's teacher said it needed to be more engaging for the audience. The teacher suggested making the slides push in. What feature is Lucy's teacher referring to?

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Lucy completed her PowerPoint presentation and showed it to her teacher to review. Lucy's teacher said it needed to be more engaging for the audience. The teacher suggested making the slides push in.

The teacher referring to the Transitions effect that is push while making the slides.

You can insert different Transition effect on your slides while going through the Transitions tab on the ribbon, and then select your desired effect on the selected/active slide. There are tens of transitions effect, you can search for your desired effect on your slide, such as Lucy's teacher suggested to her to add a push-in effect.

Answer: Transition, I just finished my test for this lesson! I got an 100% on it!

Explanation: When you go and read through the lesson, there's a page telling you about each tab. When you go to "Transitions", there is an image that shows the features for transitioning your slides. The options shown in the picture is "existing", "none", "morph", "cut", "fade", "wipe", and "push".

Checkpoint 10.43 Write an interface named Nameable that specifies the following methods: _______{ public void setName(String n) public String getName()} Fill in the blank.

Answers

Answer:

Fill the blank with

public interface Nameable {

Explanation:

Required

Complete code segment with the interface definition

The given code segment is divided into three parts

1. The interface

2. The method that returns nothing

3. The method that returns string

The blank will be filled with the definition of the interface.

The definition is as follows:

public interface Nameable {

Analyzing the above definition

public -----> This represents the modifier

interface ------> This represents that the definition is an interface

Nameable ------> This represents the name of the interface

A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
R, T and W. The motor is switched off when the output from the logic circuit is 1.

Answers

Answer:

motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors

R, T and W. The motor is switched off when the output from the logic circuit is 1. wym

If a document is stored on a file server but team members can edit the document​ anonymously, the content on the file server is:_______a. shared content with version management b. shared on Google drive c. shared content with no control d. shared with the public e. shared content with version control

Answers

Answer:

d

Explanation:

Because a decimal number

If a document is stored on a file server but team members can edit the document​ anonymously, the content on the file server is considered to be a: c. shared content with no control.

Cloud computing can be defined as a type of computing that requires shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.  Thus, it offer or avail individuals and businesses a fast, effective and efficient way of providing services to their clients over the internet.

Generally, cloud computing comprises three (3) service models and these are;

Infrastructure as a Service (IaaS). Software as a Service (SaaS). Platform as a Service (PaaS).

A file server can be defined as a type of computer that centrally stores, manage and fetch all data files (audio, image, text and video) as they are requested over the internet or network by end users (clients).

An access control refers to a security technique that is used to determine whether a user has the minimum requirements (credentials) to access, use or view resources such as documents on a computer by ensuring they are who they claim to be (authentication).

In this context, when a document (content on a computer) is shared on a file server without the implementation of an access control, the file can be anonymously edited by end users because it won't ask or request for authentication.

However, a shared content on a file server with an access control would only grant permission to authorized users while denying other users access to edit or modify its content.

Find more information: https://brainly.com/question/14014672

a bus is full of passengers. if you count them by either twos, threes, or fives, there is one left. if you count them by seven there will be none left. find the least number of passengers in the bus?​

Answers

Answer:

91

Explanation:

You know that the number must end in 6 or 1 to get a left over of 1 when divided by 5. Six won't work because  2  divides evenly into a number ending into 6.

So the number ends in 1.

21 doesn't work because 3 divides into 21 evenly.

31 doesn't work because 7 does not divide into it.

41 doesn't work. 41 is prime. 7 won't divide into it.

51 is divisible by 3

61 seven does not evenly divide into 61.

71 seven leaves a remainder of  1

81 7 leaves a remainder.

91 Answer

How does entering search terms in quotation marks affect search results?

Answers

if it is in quotations someone said or wrote those words, so when you search in quotation those are someone’s words and it might show who’s words they are.

Write a function that returns a pointer to the maximum value of an array of float ingpoint data: double* maximum(double* a, int size) If size is 0, return NULL.

Answers

Answer:

double * maximum( double arr[], int size){

   int max = 0;

   if ( size == 0){

       return 0;

   } else {

        for (int i = 1; i < size; i++){

           if (arr[i] > arr[0]){

               max = arr[i];

           } else {

               max = arr[0];

           }

         }

         return max;

   }

}

Explanation:

The C++ source code above returns the maximum value of an array as a pointer. The function accepts two parameters, the array in question and the size of the array. The for loop iterates over the items in the array and checks for the largest, which is returned as a pointer since the function "maximum" is defined as a pointer to the floating-point number memory location.

Write a function gcd(x, y) that returns the greatest common divisor of the parameters x and y. Use the Euclidean algorithm to do this. Return None if the gcd does not exist(i.e., if both parameters are 0)

Answers

Answer:

function gcd(x,y) {

if (!y && !x) return 'None';

if (!y) return x;

return gcd(y, x%y);

}

console.log(gcd(462, 910));

console.log(gcd(0, 0));

console.log(gcd(32, 40));

Explanation:

This example is in javascript.

How are computers connected to one another?

through networks

through printers

through laptops

Answers

Answer:

They are connected through networks

Explanation:

N/A

Answer:

the other guy is correct

Explanation:

how do hardware and software work together to allow a user to perform a function?
jointly, independently, repeatedly or separately?

Answers

Answer:

jointly

Explanation:

Because Hardware and Soft ware have to JOIN together to make something work

I hope i helped!

Hardware and software collaborate to enable a user to perform a function. The physical components of a computer system, such as the central processing unit (CPU) and memory, are referred to as hardware.

What is CPU?

CPU is an abbreviation for Central Processing Unit, which is the main component of a computer system that is in charge of executing instructions and processing data.

The CPU is often referred to as the computer's "brain" because it performs the majority of the calculations.

When a computer user performs a function, the software sends instructions to the hardware, which then executes the instructions and performs the function.

When a user types on a keyboard to create a document, for example, the keyboard sends signals to the CPU, which processes the input and sends the output to the software application to display on the screen.

Thus, in this way, hardware and software are interdependent and work together to enable a user to perform a variety of functions on a computer system.

For more details regarding CPU, visit:

https://brainly.com/question/16254036

#SPJ7

Write bash script which takes array as an input of size 10 bind its even indexes to accept even values and odd indexes to accept odd numbers only. Print invalid input if given input is not valid.

Answers

Answer:

Bash script which takes array as an input of size 10 bind its even indexes to accept even values and odd indexes to accept odd numbers only is explained below in detail.

Explanation:

Even digits at an even table and odd digits at an odd table

Given an array of size n comprising an equal number of odd and even digits. The difficulty is to manage the numbers in such an approach that all the even digits get the even table and odd digits get the odd table. The necessitated auxiliary space is O(1).

Examples :

Input : arr[] = {8, 5, 1, 12, 6, 3}

Output : 3 6 1 12 5 8

Input : arr[] = {7, 9, 10, 19, 13, 18, 21, 20, 4, 14}

Output : 18 9 10 19 20 7 14 13 4 21

Input a number and find the square root only if the number entered is greater than or equal to zero.

Answers

number = float(input("Enter a number: "))

if number >= 0:

   print(number**0.5)

I hope this helps!

Alex has composed a layout with this Image for a magazine. Which rule of composition has Alex applied?
OA. alignment
OB. golden ratio
OC.unity
OD. contrast

Answers

Answer:

B. golden ratio

Explanation:

Golden ratio is a composition has Alex applied.

What is Golden ratio?

The Greek letter "phi" is used to represent the golden ratio, a specific number that is roughly 1.618.

It frequently appears in geometry, fine art, architecture, and other fields. Euclid referred to the golden ratio as the extreme and mean ratio, and Luca Pacioli referred to it as the heavenly proportion, among other titles.

Since ancient times, mathematicians have researched the characteristics of the golden ratio. It appears in the building of the dodecahedron and icosahedron as the ratio of a regular pentagon's diagonal to its side.

Therefore, Golden ratio is a composition has Alex applied.

To learn more about Golden ratio, refer to the link:

https://brainly.com/question/29567506

#SPJ2

b) Machine cycle defines a loop process with four major components. Explain why machine cycle is important? If the components of machine cycle are inter-swapped, would that cause any problems?Can we add another module to rectify the problem caused by inter-swapping?

Answers

Answer:

Machine cycle defines a loop process with four major components is explained below in detailed explanation.

Explanation:

The machine cycle has four methods i.e. fetch method, decoding method, execute method, and store method. All these methods are essential for the preparation performance of the processor. By the machine cycle, the execution of the processor can be measured and the device can be decided.

Importance of Machine Cycle

The machine cycle is essential for the execution of machine direction by the computer processor as the device execution is based on the machine cycle. If the direction is not executed accurately the execution can be deteriorated by the processor.

Write a statement that calls the recursive function BackwardsAlphabet() with parameter startingLetter.

Answers

Answer:

Explanation:

The code can be computed as follows:

#include <stdio.h>

void BackwardsAlphabet(char currLetter){

if (currLetter == 'a') {

printf("%c\n", currLetter);

}

else{

printf("%c ", currLetter);

BackwardsAlphabet(currLetter - 1);

}

return;

}

int main(void) {

char startingLetter = '-';

startingLetter = 'z';

BackwardsAlphabet(startingLetter);

return 0;

}

Recursions are simply functions that calls and executes itself.

The statement that calls the recursive function is: BackwardsAlphabet(startingLetter);

From the question, we have the following parameters

Function name: BackwardsAlphabetFunction parameter: startingLetter

The syntax of calling a function is:

function_name(function_parameter);

So, the statement that calls the function is:

BackwardsAlphabet(startingLetter);

The above statement is true for several programming languages such as C, C#, C++, Java, Python, etc.

Read more about recursive functions at:

https://brainly.com/question/13657607

what are the characteristics needed in a secure hash function?​

Answers

Cryptographic hash functions are utilized in order to keep data secured by providing three fundamental safety characteristics: pre-image resistance, second pre-image resistance, and collision resistance.

The characteristic needed in a secure hash function is image resistance functions.

What are the characteristics?

Characteristics refer to any feature or trait of any object which provides any information about the concept. These are unique in nature and makes difference with one another.

A group of cryptographic operations called Secure Hash Algorithms is designed to safeguard data. It functions by hashing the data to change it. It applies a severe value to a text before using a private key to encrypt the hash code.

One of a good hash function's essential characteristic include  The data being hashed completely determines the hash result, and the hash function uses all of the input data.

The characteristics necessary for a secure hash function are Avoiding collisions Resistance to the preimage and subsequent resistance to the preimage.

Learn more about the Secure Hash function, here:

https://brainly.com/question/2642496

#SPJ6

edhesive in JAVA Write a method that takes a String parameter. If the String has a double letter (i.e. contains the same letter twice in a row) then it should return true. Otherwise, it should return false.
This method must be named hasRepeat() and have a String parameter. This method must return a boolean.

Answers

I've included my code in the picture below. Best of luck.

The method is an illustration of loops and conditional statements.

Loops are used for repetitive operations, while the execution of a conditional statement is based on its truth value.

The hasRepeat() method in Java, where comments are used to explain each line is as follows:

   //This defines the hasRepeat() method

   public static boolean hasRepeat(String str){

       //This initializes the previous character

       char prevC = ' ';

       //This iterates through the characters of the string str

       for(int i = 0; i<str.length();i++){

           //This gets the current character

           char currC = str.charAt(i);

           //If the current character and the previous character are the same

           if(currC == prevC){

               //Return true

               return true;

           }

           //Assign the current character to the previous character

           prevC = currC;

       }

       //Return false, it the string contains no repetitive character

       return false;

   }

At the end of the method, the program returns true or false.

Read more about similar programs at:

https://brainly.com/question/14998938

What game is this?????? ?

Answers

Answer:

name the emoji

Explanation:

Answer:

Stop wasting points

Explanation:

Which of the following file formats cannot be imported using Get & Transform?
A.) Access Data table
B.)CVS
C.)HTML
D.)MP3

Answers

Answer:

The correct option is D) MP3

Explanation:

According to the given scenario, The data that can be imported using get and transform is as follows:

a. CVS

b. Hypertext markup language (HTML)

c, Access data table

The Get and transform means first get the data and then modify according to your needs.

So as per given options, the option D i.e MPC i.e. file format this cannot be imported using Get & transform

Therefore the correct option is D) MP3

Which type of cut extends an audio clip from a preceding video clip to a subsequent video clip?

K-cut

J-cut

L-cut

A-cut



Adobe Premiere Pro cc 2018

Answers

Answer:

L-cut

Explanation:

In the field of cinematography, professional video editors use video editing software application such as Adobe Premiere Pro to create wonderful and remarkable videos with the aid of various video editing techniques such as J-cut, rolling edit, ripping edit, L-cut etc.

A L-cut can be defined as a split edit technique which typically allows the audio out point of a clip to be extended beyond the video out point of the clip in order to make the audio from the preceding video clip (scene) to continue playing over the beginning of a subsequent video clip.

Hence, L-cut is a type of cut that extends an audio clip from a preceding video clip to a subsequent video clip.

write c++ program to get from user the user and print whether it is positive or negative

Answers

Answer:

I think this is positive

Explanation:

what must be the same for each variable in an array in compiled languages?

Answers

The data type must be the same for each item in the array.

Other Questions
DEFINE INCIDENCE RATE. The process of combustion, or burning, is similar to the chemical processes that release energy in cells. Wood burns at a very high temperature,about 600C. Which two statements explain how the human body is able to obtain energy without becoming too hot?A. A large percentage of the cell is protein, which prevents rapid combustion.B The breakdown-of glucose occurs in many small steps.DC. Low-temperature breakdown of glucose is enabled by enzymes that catalyze specific reactions.DBoth fuel and ample oxygen are required for fire, oxygen concentration is too low in the body to allow combustion. HELP Please ASAPThe Age of Exploration identify one new idea and one way in which it caused a change for people living at that time. Explain whether it was a positive or negative and why. Two vectors of lengths 4 and 6 have a dot product equal to 24. Which is true about the vectors?They form an acute angle.They form an obtuse angle.They point in the same direction.They point in opposite directions. i will mark you. i need help fast thank you! The melting point of table salt is 801.Is this a physical or chemical property 7- A mass initially at O moves 10.0 m to the east and then 5.0 m to thenorth. What is the final displacement of the mass? Most dermatologists recommend using sunscreens that have a Sun Protection Factor (SPF) of at least 30. One of the authors wanted to find out whether the SPF of sunscreens used by students at her school exceeds this value on average? To collect data, the author surveyed students in her introductory statistics course and found that in a sample of 52 students the mean SPF was 34.55 and the standard deviation of SPF was 20.12. The data were not strongly skewed. Required:Use the Theory-Based Inference applet to find and report the 95% confidence interval for the parameter of interest. What does core democratic values mean? Read the passage from Anne Frank: A Diary of a Young Girl.The "Secret Annexe" has heard the joyful news that each person will receive an extra quarter of a pound of butter for Christmas. It says half a pound in the newspapers, but that's only for the lucky mortals who get their ration booklets from the government, not for Jews who have gone into hiding, who can only afford to buy four ration books, instead of eight.Which excerpt from the passage best supports the idea that even good news is not as good for Anne and the others who are in hiding?"...but that's only for the lucky mortals who get their ration booklets from the government...""The 'Secret Annexe' has heard the joyful news...""It says half a pound in the newspapers...""...each person will receive an extra quarter of a pound of butter for Christmas. first person to get bit right gets brainlyist!Read the following claim. Is it supported or unsupported? Explain why or why not.According to a recent survey of students, incidents of bullying at our school have dropped 27 percent in the past three years. (writing assignment) What is the answer???? Wats your favorite animal? More and more government regulations have been placed on the quality of food made available to students, at school during the school dayWhich best describes the reason for the increased government regulations ? Which expression is equivalent to 2(5x 0.75)?10x 0.7510x + 0.7510x 1.510x + 1.5 al qadr means you are not responsible for your actions 15 marker question Is 16/27 a perfect square . Which factor led to the development of civilizations in ancient Mesopotamia? Write the equation of the line that passes through (0, 2) and (2, -4) in slope-intercept form. a. y = -3x + 2b. y = - 1/3x + 2c. y = 3x - 3d. y = -1/3x - 2 What describes using organisms that were only alive during a specific time period to estimate the unknown age of itemsA radioactive datingB law of superpositionC relative datingD index fossil