Answer to Question #12113 in C# for Sarah

Question #12113
A program that list the number from 0 to 25, their square, square roots,fourth power, and fourth root. The output should be in a neat five column format.
1
Expert's answer
2012-07-20T11:16:28-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Question12113
{
class Program
{
& static void Main(string[] args)
& {
Console.WriteLine("___________________________________________________________");
Console.WriteLine("|Number | square | square root | fourth power | fourth root|");
Console.WriteLine("|----------------------------------------------------------|");
for (int i = 0; i <= 25; i++)
{
Console.Write("|{0,6:D} |", i);
Console.Write("{0,7:D} |", i * i);
Console.Write("{0,12:G4} |", Math.Sqrt(i));
Console.Write("{0,13:G0} |", Math.Pow(i, 4));
Console.Write("{0,12:G6}|\n", Math.Pow(i, 1.0 / 4.0));
Console.WriteLine("|----------------------------------------------------------|");
}
Console.ReadKey();
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS