adddesign

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

Filed Under: , , , , , ,

Double:

Double is one of the floating point type which represents the double precision numbers. Double is 64 bits wide and has an approximate range of 5E-324 to 1.7E + 308. Many of the math function in C# class library uses Double.

Program to find the radius of Circle using the math function math.sqrt

using system;
class circle
{
public static void Main()
{
Double area;
Double radius;
area = 10.0;
radius = math.sqrt(area/3.14);
Console.WriteLine("The radius of Circle:" + radius);
}
}

Output:

The radius of Circle: 1.78412203012729

Program using math.sin, math.cos, math.tan

using system;
class trignometry
{
public static void Main()
{
Double theta;
for(theta=0.1; theta<=1.0; theta=theta+0.1) { Console.WriteLine("sine of"+theta+"is"+ math.sin(theta)); Console.WriteLine("cosine of"+theta+"is"+math.cos(theta)); Console.WriteLine("tangent of" +theta+"is"+math.tan(theta)); } } } Output:

Sine of 0.1  is 0.0998334166468282
Cosine of 0.1 is 0.995004165278026
Tangent of 0.1 is 0.100334672085451

Sine of 0.2 is 0.198669330795061
Cosine of 0.2 is 0.980066577841242
Tangent of 0.2 is 0.202710035508673

Sine of 0.3 is 0.29552020666134
Cosine of 0.3 is 0.955336489125606
Tangent of 0.3 is 0.309336249609623

__________________________________________________________________________________________

goto decimal

0 comments for this post