I think this will work.
keep up on the indentation gook work!
Code:
//S_Howlin 20/3/13
// Revision
// number between 0 and 9 by pi and check if value entered is between 0 and 9 and asks for new value if outside of 0 and 9
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main ()
{
int x;
double y;
for(;;){ //This loop ensures that the program keeps asking for a number
printf ("Please enter a value between 0 and 9 (Enter a number less than 0 to terminate): " ); // Asks to put in a value between 0 and 9 and a value less thatn 0 to terminate
scanf ( " %d", &x);
if(x<0){break;} // checks if the value entered is less than zero
if ( x > 0.0 && x < 9.0 ) // if the value is between 0 and 9 the following will be said:
{
printf( "The value entered is between 0 and 9 \n");
y = x * M_PI; // works out value for y by multiplying x with pi
printf ( "The value for y is: %0.2f\n", y); // Works out value for y to 2 decimel places
}
else //If the value is not between 0 and 9 the follwoing will be siad:
{
printf( "The value you entered is NOT between 0 and 9. \n");
}
}
getch ();
return 0;
}