|
|
Formatted output
Squares.cs
using System;
class Squares {
public static void Main(string[] arg) {
if (arg.Length == 0)
Console.WriteLine("specify a positive number as an argument");
else{
int n = Convert.ToInt32(arg[0]);
Console.WriteLine(" i i*i Sqrt(i)");
Console.WriteLine("-------------------");
for (int i = 1; i <= n; i++) {
Console.WriteLine("{0, 3} {1, 6} {2, 8:f2}", i, i*i, Math.Sqrt(i));
}
}
}
}
|
|