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