/* Program to prompt for a number, then to print its square.  */
/*  Begin with include, defines and declarations			  */

#include <stdio.h>
#include <math.h>

double square(double);


/* The main routine, prompts for and reads in number, then    */
/* gets square to calculate the square, and prints the result.*/

main()
{
	double x, xsquared;
	
	printf("Enter x: ");
	if (scanf("%lf", &x) !=1)
	{
		printf("Error reading value of x.\n");
		exit(1);
	}
	printf("x = %lf\n", x);
	
	xsquared = square(x);
	printf("xsquared = %lf\n", xsquared);
	
	exit(0);
}

/* The function which calculates the square of a number	*/

double square(double x)
{
	return x*x*x*x*x*x;
}
