- Joined
- Mar 12, 2018
- Posts
- 282
- Reaction
- 217
- Points
- 215
- Age
- 19
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
#include <stdio.h>
int main() {
float x1, y1, x2, y2, slope;
// Prompt the user to enter the coordinates
printf("Enter x1, y1, x2, y2 respectively: ");
scanf("%f%f%f%f", &x1, &y1, &x2, &y2);
// Compute the slope of the line using the formula m = (y2 - y1)/(x2 - x1)
slope = (y2 - y1) / (x2 - x1);
// Display the slope of the line with 2 decimal places
printf("The slope of the line is %.2f\n", slope);
return 0;
}
salamat sirC:#include <stdio.h> int main() { float x1, y1, x2, y2, slope; // Prompt the user to enter the coordinates printf("Enter x1, y1, x2, y2 respectively: "); scanf("%f%f%f%f", &x1, &y1, &x2, &y2); // Compute the slope of the line using the formula m = (y2 - y1)/(x2 - x1) slope = (y2 - y1) / (x2 - x1); // Display the slope of the line with 2 decimal places printf("The slope of the line is %.2f\n", slope); return 0; }
View attachment 2522713
View attachment 2522714
View attachment 2522715