1. ## Finished Slope Formula

Thank u everyone that helped me. Here is the finished source code.

----------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>

main()
{
float x1, y1, x2, y2, m ;
float X , Y ;

printf ( "To find the slope of your line enter the following: \n\n" ) ;

printf ( "The First set of points. eg. (x,y) \n" ) ;
printf ( "x: \n" ) ;
scanf ( "%f" , &x1 ) ;
printf ( "y: \n" ) ;
scanf ( "%f" , &y1 ) ;

printf ( "The Second set of points. eg. (x,y) \n" ) ;
printf ( "x: \n" ) ;
scanf ( "%f" , &x2 ) ;
printf ( "y: \n" ) ;
scanf ( "%f" , &y2 ) ;

Y = y2 - y1 ;
X = x2 - x1 ;
m = Y / X ;

printf ( "\nThe slope of the line is: %f " , m) ;
printf ( "\n\n" ) ;
system("PAUSE");

}
---------------------------------------------------------------------------

I have a few more questions, try the program and when u get your answey it will be form (eg.) 2.000000. How would i go about shortening this to 2.0?

And if 4 numbers are entered which are equal how would i desplay an error message telling the user to start again?

2. ## to shorten a double or float

printf("%2.2lf, int);

after the percent sign you will enter the digits before and after the decimal that you want.

hope this helps.

3. > How would i go about shortening this to 2.0?
Example
printf( "%.1f\n", 1234.5678 );

> And if 4 numbers are entered which are equal how would i desplay an
Code:
```do {
// all your prompt and input code
} while ( (x1 == x2) && (y1 == y2) );```