Please help me with the task: Draw a way to a safe place.

Hello, I’m working on this task:

Write a program that calculates and outputs to the screen the distance from your position (blue dot) to the destination (red dot). Tip: You need to use int variables and plus ‘+’ operation in your solution.

Here is my code:

public static class DrawToSafetyPlace
   public static void Main()
       int heigth;
       heigth = (175);
       int width;
       width = (75);
       int result = width + width + width + heigth
       int result = 0;

Can anyone please help me to solve it?

I think you have a line above your WriteLine that is messing you up. “int result = 0;” is setting your result variable to zero after the program just added the widths and height together. deleting “int result = 0;” I think will solve the issue. ooh and don’t forget to put a semicolon after “int result = width + width + width + heigth”

1 Like