Answer the question
In order to leave comments, you need to log in
How to get the square of a number and print it to the console?
Following code
using System;
namespace test3
{
class Program
{
public static void Main()
{
Print(GetSquare(42));
}
static int GetSquare(double number)
{
number = (int)Math.Round(number);
return Math.Pow(number, 2);
}
static void Print(int v)
{
Console.WriteLine();
}
}
}
num = (int)Math.Round(num);
Answer the question
In order to leave comments, you need to log in
Better do that :)
static int GetSquare(int number)
{
return number * number;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question