Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * C# Program to Find a Number using Pythagoras Theorem
- */
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- class Program
- {
- static void Main(string[] args)
- {
- double a, b, c;
- bool answer = false;
- Stopwatch sw = new Stopwatch();
- sw.Start();
- for (int n = 0;answer ==false && n < 1000 ; n++)
- {
- a = n;
- Console.WriteLine(a);
- for (int i = 0; i < n; i++)
- {
- b = a - i;
- for (int x = 0; x < b; x++)
- {
- c = b - x;
- if (a == Math.Sqrt(b * b + c * c) && a + b + c == 1000)
- {
- double d = (a * b * c);
- Console.WriteLine("Time to calculate in milliseconds : {0}", sw.ElapsedMilliseconds);
- Console.WriteLine(d);
- Console.ReadLine();
- }
- }
- }
- }
- Console.WriteLine("This is a the end");
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement