Where is a mistake?

Hello, I am a beginner in Arduino programming and I have an assignment to make a simulation of a vending machine.
Assignment is :
A bottle of soda costs: 2.5 euro.
only combinations of 0.5, 1, 2 euro are allowed (which are buttons)
At rest: red light is on AND green light is off
While waiting for the full amount: red LED flashing AND green is off.
after complete amount entered: green LED is on AND red LED is off.

The problem is that it doesn’t work the way I want it to, and leds are lighting up randomly, I am out of ideas anymore.

int Button5 = 2; //button for 50 cents
int Button1 = 3; // button for 1 euro
int Button2 = 4; // button for 2 euros
int RED = 9;
int GREEN = 13;

int buttonState1 = 0;
int lastButtonState1 = 0;

int buttonState2 = 0;
int lastButtonState2 = 0;

int buttonState3 = 0;
int lastButtonState3 = 0;

int result = 0 ;
int oldresult = 0;

unsigned long lastDebounceTime = 0; //last time the pin was toggled, used to keep track of time
unsigned long debounceDelay = 50; //the debounce time which user sets prior to run

void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
pinMode(GREEN , OUTPUT);
pinMode(RED , OUTPUT);
pinMode(Button5, INPUT);
pinMode(Button1, INPUT);
pinMode(Button2, INPUT);

}

void loop() {
// put your main code here, to run repeatedly:
buttonState1 = digitalRead(Button5);

// compare the buttonState to its previous state

if (buttonState1 != lastButtonState1) {

if (buttonState1 == HIGH);

{

result = oldresult + 5;

}
}
lastButtonState1 = buttonState1;
oldresult = result;

buttonState2 = digitalRead(Button1);

if (buttonState2 != lastButtonState2) {

// if the state has changed, increment the counter

if (buttonState2 == HIGH)

{
result = oldresult + 10;
return result;

}

}
lastButtonState2 = buttonState2;
oldresult = result;

buttonState3 = digitalRead(Button2);

if (buttonState3 != lastButtonState3)
{

// if the state has changed, increment the counter

if (buttonState3 == HIGH)

{
result = oldresult + 20;
return result;

}
}

lastButtonState3 = buttonState3;
oldresult = result;

if ((result > 0) && (result < 25))
{
digitalWrite(GREEN, LOW);
digitalWrite(RED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(RED, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
}

else if ( result == 0 )
{
digitalWrite(GREEN, LOW);
digitalWrite(RED, HIGH);
}

else if ( result >= 25)
{
digitalWrite(GREEN, HIGH);
digitalWrite(RED, LOW);
}

}

How are the inputs wired ?

Have you got pulldown resistors in place to keep them in a known state at all times or are they floating at an uncertain voltage ?

      return result;Where are you returning result to ?

 if (buttonState1 == HIGH);

Oops

As pointed out in #1, you have return statements in loop() that sometimes prevent the program from getting to the blink code. Even if it did, though, you would not see a blink because this is wrong:

delay(100);                       // wait for a second

That code waits for 100 milliseconds, not a second.

int Button5 = 2; //button for 50 cents   
int Button1 = 3; // button for 1 euro
int Button2 = 4; // button for 2 euros
int RED = 9;
int GREEN = 13;

int buttonState1 = 0;
int lastButtonState1 = 0;

int buttonState2 = 0;
int lastButtonState2 = 0;

int buttonState3 = 0;
int lastButtonState3 = 0;

int result = 0 ;
int oldresult = 0;


unsigned long lastDebounceTime = 0; //last time the pin was toggled, used to keep track of time
unsigned long debounceDelay = 50;   //the debounce time which user sets prior to run

THREE switch pins. THREE current states. THREE previous states. ONE time.

Wrong!