Skip to content

Instantly share code, notes, and snippets.

@MichaelaIvanova
Created July 12, 2017 11:57
Show Gist options
  • Save MichaelaIvanova/5d0fedb7fd45f6e6c63ebd9d031f9bd8 to your computer and use it in GitHub Desktop.
Save MichaelaIvanova/5d0fedb7fd45f6e6c63ebd9d031f9bd8 to your computer and use it in GitHub Desktop.
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