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:
Code:
#include <stdio.h>
int main()
{
int r;
float pi = 3.14159265;
printf("\nEnter the cirle's radius to calculate its area and circumfrence\n\n");
scanf("%i", &r);
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);
return 0;
}