Wednesday, 24 April 2013

Predict the output of the following program:


Predict the output of the following program:
using System;
namespace Square_Number
{
class CalculateSquare
{
int number;
public void Square(int number)
{
Console.WriteLine("The number is: {0}",number);
number *= number;
Console.WriteLine("Square of 10 is: {0}", number);
}
CalculateSquare()
{
number = 10;
Square(number);
}
static void Main(string[] args)
{
CalculateSquare cal = new CalculateSquare();
Console.ReadLine();
}
}
}
(Duration: 15 min)
the number is: 10
square of 10 is:100


No comments:

Post a Comment