using System;
public class Program
{
public static void Main(string[] args)
//Write a program that read a number that represents the max value of a sum operaration
//The program should print and add a number from 1 to N
//while sum < num
Console.Clear();
Console.Write("Introduce max value: ");
int num = Convert.ToInt32(Console.ReadLine());
int sum = 0; //Variable to store the sum
int n = 0; // Number to print and add
while (sum < num) //While the sum < max value
sum += n; // Add the value of n to sum
Console.Write("{0} ", n); // Print the current value of n
n++; //increment a by 1
}
Console.WriteLine("\nThe sum is = {0}", sum); // print the result