#include <stdio.h> #define PI 3.14159 int main() { float radius, height, volume; /* Input radius and height from the user*/ printf( "Enter the radius of the cylinder: " ); scanf( "%f" , &radius); printf( "Enter the height of the cylinder: " ); scanf( "%f" , &height); /* Calculate volume*/ volume = PI * radius * radius * height; /* Display the volume*/ printf( "The volume of the cylinder is: %.2f cubic units\n" , volume); return 0; }
Comments
Post a Comment