I want to write a code in which i want to know how much time is needed to move from one point to another.
Input
1) First line(input) is showing the maximum time required to reach
2) Second line(second and third input) shows the intial position.
3)Third line(fourth and fifth input) shows the final position.
4)fourth line shows the time taken to travel one step in left , right , up and down .
Output an integer denoting the time needs to reach, if not able to reach in time output a string Valar Codulis. Output the answer of each testcase on newline.
But my program is not running like this . why?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int c, d, e, f, b;
scanf("%d", &b);
printf("\n");
scanf("%d", &c);
scanf("%d", &d);
printf("\n");
scanf("%d", &e);
scanf("%d", &f);
printf("\n");
int g, h, i, j;
scanf("%d", &g);
scanf("%d", &h);
scanf("%d", &i);
scanf("%d", &j);
int k, l, m, n, o;
e - c == k;
f - d == l;
if (e - c >= 0, f - d >= 0)
{
m = k*h;
n = l*i;
}
else if (e - c <= 0, f - d >= 0)
{
m = k*g;
n = l*i;
}
else if (k >= 0, l <= 0)
{
m = k*h;
n = l*j;
}
else
{
m = k*g;
n = l*j;
}
o = m + n;
if (b >= o)
{
printf("\n %d", o);
}
else
{
printf("Valar Codulis");
}
}
NOTE:I am a beginner.