public static void Main()
Console.WriteLine("Enter a number between 1 and 100");
bool correctInput = false;
string input = Console.ReadLine();
Console.WriteLine("You entered: " + input);
if (int.TryParse(input, out value))
if (value <= 100 && value > 0)
Console.WriteLine("Invalid Input. Try again.");
int s = (2 * a + (n - 1) * d) * (n / 2);
Console.WriteLine("Sum of values: " + s);