Created
September 6, 2018 18:50
-
-
Save AntMooreWebDev/a4b70c04559ffb40b3d18399b44b9a10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace FiguringOutRatios | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("What width do you wanna use?"); | |
| int NewWidth = Convert.ToInt32(Console.ReadLine()); | |
| Console.WriteLine("What height do you wanna use?"); | |
| int NewHeight = Convert.ToInt32(Console.ReadLine()); | |
| Calculate(NewWidth, NewHeight); | |
| } | |
| private static void Calculate(int Width = 300, int Height = 150) | |
| { | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine("--------------"); | |
| int OriginalWidth = 300; | |
| int OriginalHeight = 150; | |
| Console.WriteLine($"Original Size: {OriginalWidth}x{OriginalHeight}"); | |
| float ScaleWidth = (float)Width / (float)OriginalWidth; | |
| float ScaleHeight = (float)Height / (float)OriginalHeight; | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine($"ScaleWidth: {ScaleWidth}"); | |
| Console.WriteLine($"ScaleHeight: {ScaleHeight}"); | |
| float Scale = Math.Min(ScaleWidth, ScaleHeight); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine($"Scale: {Scale}"); | |
| int FinalScaledWidth = (int)(OriginalWidth * Scale); | |
| int FinalScaledHeight = (int)(OriginalHeight * Scale); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine($"Final Scale: {FinalScaledWidth}x{FinalScaledHeight}"); | |
| Console.WriteLine("--------------"); | |
| Console.WriteLine("What width do you wanna use?"); | |
| int NewWidth = Convert.ToInt32(Console.ReadLine()); | |
| Console.WriteLine("What height do you wanna use?"); | |
| int NewHeight = Convert.ToInt32(Console.ReadLine()); | |
| Calculate(NewWidth, NewHeight); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment