-
-
Save MichaelaIvanova/5d0fedb7fd45f6e6c63ebd9d031f9bd8 to your computer and use it in GitHub Desktop.
This file contains 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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace algos | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int startX = 10; | |
int endDest = 85; | |
int step = 30; | |
solution(startX, endDest, step); | |
} | |
public static int solution(int X, int Y, int D) | |
{ | |
// write your code in C# 6.0 with .NET 4.5 (Mono) | |
var distance = Y - X; | |
double numSteps = (double) distance/D; | |
var c = Math.Ceiling(numSteps); | |
return (int) c; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment