Implement the Pythagorean Theorem : Double Calculation : Data Type C# Examples


C# Examples » Data Type » Double Calculation »

 

Implement the Pythagorean Theorem









    
using  System;    

class  MainClass  {          
    public  static  void  Main()  {          
        double  s1  =  3.0;  
        double  s2  =  4.0;  
        double  hypot;  
  
        hypot  =  Math.Sqrt(s1*s1  +  s2*s2);  
    
        Console.WriteLine("Hypotenuse  is  "  +  hypot);  
    }          
}
    
   
  
   



Output

Hypotenuse is 5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Double Calculation