i need ur help with my code i dont no what i did wrong pls answer .

Hi! Can you please help me with my code? I attach a copy below.

I am working on motor controlling and flow sensor with pwd .what i am trying is ,when i push the button motor is high and flow sensor counts pulses .after reaching 30 pulses flow sensor should stop the pulses and also motor also low .can you please help me with my code?.

int pwm = 3;
int input = 12;
const int buttonPin = 2;  
byte pwmValue1 = 0;
byte pwmValue = 0;
volatile unsigned int pulse; 
const int pulses_per_litre = 450; 
int buttonState = 0;         // variable for reading the pushbutton status

//volatile unsigned int pulse;
void setup()
{
  Serial.begin(9600); 
//  attachInterrupt(0, count_pulse, RISING); 
pinMode(buttonPin, INPUT);
attachInterrupt(0, count_pulse, RISING); 
}
void loop()
{
pulse=0; 
interrupts(); 
delay(1000); 
noInterrupts(); 
  
buttonState = digitalRead(buttonPin);
 if (buttonState == HIGH) 
 {
  analogWrite(pwm,30);
  analogWrite(input,pulse);
 // pwmValue1++;
  delay(500);
  Serial.print("Pulses per second: "); 
  Serial.println(pulse); 
   analogWrite(pwm,0);
   delay(500);
  //pwmValue++;
Serial.print("Pulses per second: "); 
Serial.println(pwmValue); 
  delay(10);
 
 }

Where does loop() end?
Where is count_pulse() defined?

And where does noInterrupts() end?

...R

And when you use some different code that actually complies and runs, what happens ?