adddesign

By Think Positive, Get Positive on 4:47:00 PM

Filed Under: , ,

Two More Examples using Variables:

Program 3:
using Sysytem;
class program3
{
public static void Main()
{
double x; // declares a floating point variable x
int y; // declares a integer variable y
x=101.0; // assigned 101.0 to x
y=101; // assigned 101 to y
Console.WriteLine("The value of x:"+x); // print a value of x followed by the given strings
Console.WriteLine("The value of y:"+y); // Print a value of y followed by the given strings
Console.WriteLine(); //Prints a blank line
x=101.0/2; // assigned 101.0 divided by 2 to x
y=101/2; // assigned 101 divided by 2 to y
Console.WriteLine("The value of x/2:"+x);
Console.WriteLine(" The value of y/2:"+y);
}
}

output:
The value of x: 101.0
The value of y: 101

The value of x/2: 50.5
The value of y/2: 50

Program 4:
// Area of Circle
using Sysytem;
class area
{
public static void Main()
{
double radius, area;
radius=10.0;
area= radius*radius*3.1416;
Console.WriteLine("Area of Circle:"+area);
}
}

output:
Area of Circle: 314.16

goto Integers

0 comments for this post