C# Chapters

C# Program To Calculate Square And Cube Of Given Number

Expressions - C# Language Fundamentals
using System;

class Program
{
    static void Main()
    {
        int Number = 4, Square, Cube;
        
        Square = Number * Number;
        Cube = Number * Number * Number;
        
        Console.Write("Number is : " + Number);
        Console.Write("\nSquare of " + Number + " is : " + Square);
        Console.Write("\nCube of " + Number + " is : " + Cube);
    }
}

Output :
Number is : 4
Square of 4 is : 16
Cube of 4 is : 64

Leave a comment
Recent Comments
No Comments