using System;
public class Program
{
// All of these are static so we don't have to bother with instantiation.
static int total = 25; // Initialized to 25.
// Just a regular method rather than an event handler.
// We can call this from Main() to simulate a button click.
// This only works because sender and e are unused.
static void click()
int x = total - 15;
int y = bubblegum(x + 2);
displaytotal(y);
}
static int bubblegum(int q)
for (int i = 0; i < 5; i++)
q = q + 10;
if (q < 30)
total = total + 4;
return q;
static void displaytotal(int super)
total = total + super;
Console.WriteLine("total: " + total); // Print total to console instead of lbltotal
public static void Main()
click();