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
wariber [46]
3 years ago
11

Write a function which multiplies the values in odd position values by 10. Odd positions in this case refers to the first value

in the list, the third value, the fifth value etc
Engineering
1 answer:
xxMikexx [17]3 years ago
5 0

Answer:

Using linkedlist on C++, we have the program below.

Explanation:

#include<iostream>

#include<cstdlib>

using namespace std;

//structure of linked list

struct linkedList

{

  int data;

  struct linkedList *next;

};

//print linked list

void printList(struct linkedList *head)

{

  linkedList *t=head;

 

  while(t!=NULL)

  {

      cout<<t->data;

      if(t->next!=NULL)

      cout<<" -> ";

     

      t=t->next;

  }

}

//insert newnode at head of linked List

struct linkedList* insert(struct linkedList *head,int data)

{

  linkedList *newnode=new linkedList;

  newnode->data=data;

  newnode->next=NULL;

 

  if(head==NULL)

  head=newnode;

  else

  {

      struct linkedList *temp=head;

      while(temp->next!=NULL)

      temp=temp->next;

     

      temp->next=newnode;

     

      }

  return head;

}

void multiplyOddPosition(struct linkedList *head)

{

  struct linkedList *temp=head;

  while(temp!=NULL)

  {

      temp->data = temp->data*10; //multiply values at odd position by 10

      temp = temp->next;

      //skip odd position values

      if(temp!= NULL)

      temp = temp->next;

  }

}

int main()

{

  int n,data;

  linkedList *head=NULL;

 

// create linked list

  head=insert(head,20);

  head=insert(head,5);

  head=insert(head,11);

  head=insert(head,17);

  head=insert(head,23);

  head=insert(head,12);

  head=insert(head,4);

  head=insert(head,21);    

 

  cout<<"\nLinked List : ";

  printList(head); //print list

 

  multiplyOddPosition(head);

  cout<<"\nLinked List After Multiply by 10 at odd position : ";

  printList(head); //print list

 

  return 0;

}

You might be interested in
The status of which of these determines the sequence in which output devices, such as solenoid values and motor contactors, are
Mkey [24]
A. Physical I/O sensors

Safety switches, operator inputs, travel limit switches etc
5 0
3 years ago
A tank with some water in it begins to drain. The function v ( t ) = 46 − 3.5 t determines the volume of the water in the tank (
olchik [2.2K]

Answer with Explanation:

Part a)

The volume of water in the tank as a function of time is plotted in the below attached figure.

The vertical intercept of the graph is 46.

Part b)

The vertical intercept represents the volume of water that is initially present in the tank before draining begins.

Part c)

To find the time required to completely drain the tank we calculate the volume of the water in the tank to zero.

0=46-3.5t\\\\3.5=46\\\\\therefore t=\frac{46}{3.5}=13.143minutes

Part d)

The horizontal intercept represents the time it takes to empty the tank which as calculated above is 13.143 minutes.

7 0
4 years ago
How much cornfield area would be required if you were to replace all the oil consumed in the United States with ethanol from cor
zaharov [31]

Answer:

2377.35 km

Explanation:

Given the following;

1. A cornfield is 1.5% efficient at converting radiant energy into stored chemical potential energy;

2. The conversion from corn to ethanol is 17% efficient;

3. A 1.2:1 ratio for farm equipment to energy production

4. A 50% growing season and,

5. 200 W/m2 solar insolation.

As per our assumptions,1.2/1 is the ratio for farm equipment to energy production,

So USA need around 45.45% (1/(1+1.2) replacement of fuel energy production which is nearly about = 0.4545*10^{20} J/year = \frac{0.4545*10^{20}}{365*24*3600}=1.44121*10^{12} J/sec

Growing season is only part of year ( Given = 50%),

Net efficiency = 1.5%*17%*50%=0.015*0.17*0.5=0.001275 = 0.1275%

Hence , Actual Energy replacement (Efficiency),

=\frac{1.44121*10^{12}}{0.001275} = 1.13*10^{15} J/sec=1.13*10^{15} W

As per assumption (5),

\because 200 W/m2 solar insolation arequired,

So USA required corn field area = 1.13*10^{15}/200 = 5.65*10^{12} m^{2}

Hence, length of each side of a square,

= (5.65*10^{12} )^{0.5} = 2377.35 km

4 0
4 years ago
Doubling the diameter of a solid, cylindrical wire doubles its strength in tension.
julsineya [31]

Answer:

True ❤️

-Solid by solid can make Cylindrical wire doubles Strengths in tension

4 0
3 years ago
Help I need to know if it’s true or false
e-lub [12.9K]

Answer:  False

explanation: for a bloodborne pathogen to spread you would have to have an open wound as well as the blood would have to get in it.

3 0
3 years ago
Other questions:
  • In this assignment, you will write a user interface for your calculator using JavaFX. Your graphical user interface (GUI) should
    11·1 answer
  • A process engineer performed jar tests for a water in order to determine the optimal pH and dose using alum. A test was conducte
    13·1 answer
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • Explain how a CO2 cartridge powers the dragster you will be building. A good website to use is How Stuff Works. (howstuffworks.c
    7·2 answers
  • Consider the gas carburizing of a gear of 1018 steel (0.18 wt %) at 927°C (1700°F). Calculate the time necessary to increase the
    12·1 answer
  • Solving Expressions Analytically 1 point Consider the following equation, which describes the speed of sound a in an ideal gas:
    12·1 answer
  • What are the 2 reasons an alignment should be done?
    13·1 answer
  • The typical Canadian worker is able to produce 100 board feet (a unit of measure) of lumber or 1000 light bulbs per year. The wo
    12·1 answer
  • Me ayudas plis noce ​
    14·1 answer
  • The sum of forces on node 2 (upper-left) is ______.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!