C programming 8 decimal places
Hello all, this is my first ever forum post so apologies in advance for any mistakes I make.
I was asked to create a program which would calculate a circle's circumference and area given the user enters the radius. One specification is to declare pi to 8 decimal places. I understand this cannot be achieved using the float data type but I cannot get double to work, so have used float as a temporary solution. My code is:
float pi = 3.14159265;
printf("\nEnter the cirle's radius to calculate its area and circumfrence\n\n");
printf("\nThe circle with a radius of %i has an area of %f and a circumference of %f\n\n", r, pi*r*r, 2*pi*r);