Cube(Square)

using System; using System.IO; using System.Linq; using System.Collections.Generic; namespace CubeSquare { public class Program { public static void Main() { //Taking input Console.Write("Enter a Number : "); int number = int.Parse(Console.ReadLine()); //Calling Method int cube, square; Cube(out cube, number, out square); //Printing outputs Console.WriteLine("\n{0}^3 = {1}", number, cube); Console.WriteLine("{0}^2 = {1}", number, square); } //Methods public static void Cube(out int cube, int number, out int square) { cube = number * number * number; square = Square(number); } public static int Square(int number) { number = number * number; return number; } } }

Comments

Popular Posts