2
always receive as a result: 0.000000
#include<stdio.h>
#include<math.h>
int main()
{
float x1, y1, x2, y2, resultado;
printf("insira x1:");
scanf("%f", &x1);
printf("insira y1:");
scanf("%f", &y1);
printf("insira x2:");
scanf("%f", &x2);
printf("insira y2:");
scanf("%f", &y2);
resultado = sqrtf((powf((x2 - x1), 2)) + (powf((y2 - y1), 2)));
printf("resultado:");
printf("%f\n", &resultado);
printf("pressione qualquer tecla para sair.");
getch();
return 0;
}
Objective: to calculate the distance between two points in the Cartesian plane
– Augusto
This code can compile?
– Eric Platon
Edit your question instead of adding your question information in comments
– Math