simeon3000

BPM Counter

Jun 2nd, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1.             int bpm = int.Parse(Console.ReadLine());
  2.             int beats = int.Parse(Console.ReadLine());
  3.  
  4.             double bars = Math.Round(beats / 4.0, 1);
  5.             double lenght = (double)beats / bpm;
  6.  
  7.             int min = (int)Math.Floor(lenght);
  8.             int sec = (int)Math.Floor(lenght * 60 % 60);
  9.                                
  10.             Console.WriteLine($"{bars} bars - {min}m {sec}s");
Add Comment
Please, Sign In to add comment