🔒 Closed Pa help naman nito mga idol C language

Status
Not open for further replies.
C:
#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;
}

1676624560264.webp

1676624600527.webp
1676624641176.webp
 
C:
#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
salamat sir
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 512
    Views
  • 3
    Participants
Last reply from:
iamj

Trending Topics

Online now

Members online
1,378
Guests online
3,559
Total visitors
4,937

Forum statistics

Threads
2,304,468
Posts
29,160,004
Members
1,196,805
Latest member
adpa
Back
Top