Advertisement
Guest User

Problem 9

a guest
Nov 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. /*
  2.  *  C# Program to Find a Number using Pythagoras Theorem
  3.  */
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. class Program
  9. {
  10.     static void Main(string[] args)
  11.     {
  12.  
  13.         double a, b, c;
  14.         bool answer = false;
  15.         for (int n = 0;answer ==false ; n++)
  16.         {
  17.             a = n;
  18.             for (int i = 0; i < n; i++)
  19.             {
  20.                 b = a - i;
  21.                
  22.             for (int x = 0; x < b; x++)
  23.                 {
  24.                     c = b - x;
  25.                     if (c == Math.Sqrt(a * a + b * b) && a + b + c == 1000)
  26.                     {
  27.                         double d = (a * b * c);
  28.                         Console.WriteLine(d);
  29.                         Console.ReadLine();
  30.  
  31.                     }
  32.                    
  33.                 }
  34.             }
  35.         }
  36.         Console.ReadLine();
  37.     }
  38.        
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement