Beatty sequence | C # implementation of the above approach ; Function to print the first N terms of the Beatty sequence ; Driver code
using System ; class GFG { static void BeattySequence ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { double ans = Math . Floor ( i * Math . Sqrt ( 2 ) ) ; Console . Write ( ans + " , ▁ " ) ; } } public static void Main ( ) { int n = 5 ; BeattySequence ( n ) ; } }