class SumNumber
Output:
{
static void Main()
{
int n = 0;
Console.WriteLine("Enter the number");
Console.Write("The Num = ");
n = int.Parse(Console.ReadLine());
int num = 1;
int sum = 1;
Console.Write("The sume is :
1");
while (num < n)
{
num++;
sum += num;
Console.Write("+" + num);
}
Console.WriteLine(" = " + sum);
Console.ReadLine();
}
}
Output:
No comments:
Post a Comment