using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int a = 4;
int b=aaa(a);
Response.Write(b+"----"+a);
//int[] comparValue = { 11, 22, 11, 11, 33, 11, 22 };
//var query = (from num in
// (
// from number in comparValue
// group number by number into g
// select new
// {
// number = g.Key,
// cnt = g.Count()
// }
// )
// orderby num.cnt descending
// select num.number).First();
//Response.Write(query);
//var num = new string[] { "111","2222","111","55555"};
//var linqVal = from nums in num
// group nums by nums.Length into newLinq
// orderby newLinq.Key descending
// select new
// {
// count = newLinq.Key,
// word = newLinq
// };
//foreach (var i in linqVal)
//{
// Response.Write(string.Format("长度是:{0}<br>", i.count));
// foreach (var j in i.word)
// {
// Response.Write(string.Format(" {0}<br>", j));
// }
//}
//int[] intNum = new int[100];
//System.Collections.ArrayList myList = new System.Collections.ArrayList();
//Random rom = new Random();
//while (myList.Count < 100)
//{
// int num = rom.Next(1,101);
// if (!myList.Contains(num))
// myList.Add(num);
//}
//for (int i = 0; i < 100; i++)
//{
// intNum[i] = (int)myList[i];
//}
//var Asc = from l in intNum
// orderby l ascending
// select l;
//foreach (var i in Asc)
//{
// Response.Write(i+"</br>");
//}
//Response.Write(Process1(5));
// Response.Write(Process2(100));
// Response.Write(Process3(9) - Process3(8));
}
public int aaa(int aa)
{
return aa = aa * aa;
}
//public static int Process1(int i)
// {
// //计算数组{1,1,2,3,5,8.......} 第30位值
// if (i == 0) return 0;
// if (i == 1) return 1;
// else
// return Process1(i - 1) + Process1(i - 2);
// }
//public static int Process2(int i)
//{
// //计算1+2+3+4+...+100的值
// if (i == 0) return 0;
// else
// return Process2(i - 1) + i;
//}
public static int Process3(int i)
{
//计算1 -2 +3 -4+ 5- 6 + 7 - 8 + 9的值
if (i == 0) return 1;
if (i == 1) return 2;
else return Process3(i - 2) + i;
}
}
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j <= i; j++)
{
Console.Write(string.Format("{0}*{1}={2}\t",i,j,i*j));
}
Console.WriteLine();
}
}
}
}