What's new

C & C++ Pa help naman nito mga idol C language

Rojen G Embate

Honorary Poster
Joined
Mar 12, 2018
Posts
275
Reaction
217
Points
209
Age
19
daming pina pagawa ng instructor namin di man lang nag bigay ng examples pano gawin yan

329871491_953008309406769_7317267789791521747_n.jpg
 

Attachments

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.png


1676624600527.png

1676624641176.png
 

Attachments

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
 

Similar threads

Back
Top