using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class
Program
{
static
void Main(string[]
args)
{
Console.WriteLine("Enter limit");
int
limit = Convert.ToInt16(Console.ReadLine());
int
sum = 0;
for
(int i = 0; i <= limit; i++)
{
sum = sum + i;
}
Console.WriteLine("The sum is :" + sum.ToString());
Console.WriteLine("end");
Console.ReadLine();
}
}
}
No comments:
Post a Comment