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
What is the average speed of a car that travels 80km in 1.5 hours
DanielleElmas [232]

Answer:53.33km/hr.

Explanation:

Average speed =

distance traveled/time taken

Average speed =80km/1.5hr=53.33km/hrs

5 0
4 years ago
Read 2 more answers
Determine the following for a south facing surface at 30� slope in
lesantik [10]

Answer:

z=60.32°, i=0.32°, Beam Radiation = 1097.2 W/m²,  Id = 94.2 W/m², Ir=14.1W/m², total radiation = 1205.4 W/m², Local time=1:21PM

Explanation:

A. Zenith Angle:

As we know that,

Zenith angle=z=90⁰-α=L(latitude)=29.68⁰

Another way to do it is to find α first,

At solar time hour angle is 0⁰. So, solar altitude becomes equal to latitude which could be written as

sinα=cosL

α=sin⁻¹(cosL)=sin⁻¹(cos29.68⁰)=60.32°

B. Angle of incidence:

angle of incidence= cosi=sin(α+β)=sin(60.32°+32°)=sin92.32°

i=cos⁻¹(sin92.32°)=0.32°

C. Beam Radiation:

First we need to calculate extra terrestrial radiations

Iext.=1353[1+0.034cos(360n/365)]

where n=264

=1345 W/m²

Now,

Beam Radiation=CIext⁻ⁿ

where n=0.1/sin60.32°

Beam Radiation = 1097.2 W/m²

D. Diffude Radiation:

difuse radiation = Id = 0.0921ₙcos²(β/2)

where β=30°

Id = 94.2 W/m²

E. Reflected Radiations:

Ir=pIn(sinα+0.092)sin²(β/2)

= (0.2)(1097.1)(sin60.32+0.092)sin²(30/2)

= 14.1W/m²

F. Total Radiation:

total radiation = beam radiation + diffuse radiation + reflected raddiation

= 1205.4 W/m²

G. Local Time:

LST= ST-ET-(lₓ-l(local))4min/₀

     = 12:00-7.9min-(75°-82.27°)4min/₀

     =12:21PM

Local time

LDT=LST+=12:21+1:00=1:21PM

5 0
3 years ago
A wastewater is to be disinfected using ultraviolet (UV) light. Batch experiments find that the bacterial concentration decays u
Ksivusya [100]

Answer:

k = 0.1118 per min

Explanation:

Assume;

Initial number of bacteria = N0

Number of bacteria IN 'T' time = Nt

So,

Nt=N0e^{-kt}\\\\in\ 6.2 min\\\\\\frac{N0}{2}= N0e^{-k(6.2)}\\\\ln\frac{1}{2} = -k[6.2]

k = 0.1118 per min

7 0
3 years ago
One more because i am running out of points! Have a lovely rest of your guyses day! :)
VMariaS [17]

Answer:

thank you

Explanation:

so much for that

8 0
3 years ago
A one-dimensional slab without heat generation has a thickness of 20 mm with surfaces main- tained at temperatures of 275 K and
vlada-n [284]

Answer:

a) 512.5 KW/m2

b) 40.75 KW/m2

c) 2 KW/m2

Explanation:

Given data;

T_2 = 325 K

T_1 = 275 K

dx = 0.20 mm

a) for aluminium   K = 205 W/m k

heat flux = k \frac{dt}{dx}

               = 205 \frac{325 - 275}{0.02}

               = 512.5 KW/m2

b) for AISI 316 stainless steel

k = 16.3 W/ m k

heat flux = k \frac{dt}{dx}

               = 16.3 \frac{325 - 275}{0.02}

               = 40.75 KW/m2

C) for Concrete

k = 0.8 W/ m k

heat flux = k \frac{dt}{dx}

               = 0.8 \times \frac{325 - 275}{0.02}

               = 2 KW/m2

6 0
3 years ago
Other questions:
  • What are some basic research topics for writing a research paper for first-year software students?
    15·2 answers
  • Find the pressure exerted by the water bed on the floor when the bed rests in its normal position. Assume the entire lower surfa
    12·1 answer
  • Does the Diesel engine have sparkling plugs? If yes, for what reason?
    10·1 answer
  • Toddlers are children from three to four years of age.<br> True<br> False
    15·2 answers
  • Air with a mass flow rate of 2.3 kg/s enters a horizontal nozzle operating at steady state at 450 K, 350 kPa, and velocity of 3
    5·1 answer
  • How to improve the speed of train passing through turnout​
    9·1 answer
  • What are some constraints related to size, time, or materials? Remember, constraints are limitations, issues, or obstacles.
    6·1 answer
  • What parts of a ship have plastic? And what type of plastic?
    8·1 answer
  • What happens if you leave your car on while pumping gas
    8·1 answer
  • Discuss the microstrucral transformation of eutectic reaction, hypo-eutecticand hyper eutectic. Including temperature, reactions
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!