Using C# and including comments: Name this project SquaresAndCubes Write a Conso
ID: 2246872 • Letter: U
Question
Using C# and including comments: Name this project SquaresAndCubes Write a Console Application initializes a variable to an integer value then prints out a table with the number, its square, and its cube. The program then adds one to the value and does the same on the next line. The program then adds one to the value again and does the same on the third line. The program then adds one to the value again and does the same on the fourth line: Example: If the value is 3 then the output should look like this: Number Square Cube 3 9 27 4 16 64 5 25 125 6 36 216
Name this project SquaresAndCubes Write a Console Application initalizes a variable to an integer value then prints out a table with the number, its square and its cube. The program then adds one to the value and does the same on the next line The program then adds one to the value again and does the same on the third line. The program then adds one to the value again and does the same on the fourth line: Example If the value is 3 then the output should look like this: Number Square Cube 16 25 36 27 64 129 216 4 6Explanation / Answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
string a = Console.ReadLine();
int s;
Int32.TryParse(a, out s);
Console.WriteLine("Number Square Cube");
for(int i=s;i<s+4;i++){
Console.WriteLine("{0} {1} {2}",i,i*i,i*i*i);
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.