// COMP1511 programming example // // Convert a measurement in feet to metres // // A simple program demonstrating the use of scanf, // printf and an if statement // // Andrew Taylor - andrewt@unsw.edu.au // 11/3/2017 #include int main(void) { double x, absoluteValue; printf("Enter number: "); scanf("%lf", &x); absoluteValue = x; if (x < 0) { absoluteValue = -1.0 * x; } printf("The absolute value of %f is %f\n", x, absoluteValue); return 0; }