/* * circle_cons.c * * Created on: Dec 10, 2020 * Author: johnsontimoj */ //////////////////////////// // // Laptop Program // Be sure to use a C/C++ Project // ///////////////////////////// /////////////////////////////// // // This program prompts the user for // a radius (float) and prints the // circumference and area of the // corresponding circle // // inputs: radius // outputs: prints circumference and area // /////////////////////////////////// // Preprocessor Directives #include #include #define PI 3.14159 // Global Declarations // Main int main(void){ setbuf(stdout, NULL); // fixes CodeComposer bug // Local variables float radius; float circumference; float area; while(1){ // infinite loop // Get input for radius printf("Please enter a value for radius: "); scanf("%f", &radius); // Calculate circumference and area circumference = 2*PI*radius; area = PI*radius*radius; // Output results printf("Circumference = %f\n", circumference); printf("Area = %f\n", area); // Delay for 1 sec // Sleep() is a function in // Sleep() delays for the number of msec inside the () // delay for 1,000 ms -> 1 sec Sleep(1000); // Print a blank line between loops printf("\n"); } // end while return 0; // required return } // end main