putting 2 codes together?

Hello!
Me and my friend is new to the Arduino, and we are doing a project. We have made two separate codes, and now we want them to work together.
What tool can you use to make them work together?

  1. code

nsigned long time, start, finished, elapsed;

void setup()
{
Serial.begin(9600);
pinMode(2, INPUT); // start button
pinMode(3, INPUT); // stop button
Serial.println(“Press 1 for Start/reset, 2 for elapsed time”);
}

void displayResult()
{
float h,m,s,ms;
unsigned long over;
elapsed=finished-start;
h=int(elapsed/3600000);
over=elapsed%3600000;
m=int(over/60000);
over=over%60000;
s=int(over/1000);
ms=over%1000;
Serial.print("Raw elapsed time: ");
Serial.println(elapsed);
Serial.print("Elapsed time: ");
Serial.print(h,0);
Serial.print("h ");
Serial.print(m,0);
Serial.print("m ");
Serial.print(s,0);
Serial.print("s ");
Serial.print(ms,0);
Serial.println(“ms”);
Serial.println();
}

void loop()
{
start=millis();
time = millis();
while (time < 100000){
time = millis();
delay(1000); // for debounce
finished=millis();
displayResult();
}
}

  1. code

int switchPin = 8;
int ledPin = 13;

void setup()
{
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{

if (digitalRead(switchPin) == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
h
int switchPin = 8;
int ledPin = 13;

void setup()
{
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{

if (digitalRead(switchPin) == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}

Always use code tags when posting code.

read this:- http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

And this