How to print the squares of 1st 10 numbers?

Ddd
Posted by Ddd under LINQ category on | Points: 40 | Views : 1403
using System;
using System.Linq;
class sqr
{
static void Main()
{
var a=Enumerable.Range(1,10);
var b=from p in a select p*p;
Console.WriteLine("the squares are");
foreach(var z in b)
{
Console.WriteLine(z);
}
}
}

Comments or Responses

Login to post response