Calculate Surface Area of a Cylinder

This code calculates the surface area of a cylinder based on user-provided radius and length. The formula used incorporates the constant PI for accurate computation. The program prompts the user for input and displays the final output after calculation.
mail@pastecode.io avatar
unknown
c_cpp
5 months ago
275 B
0
Indexable
#include <stdio.h>
#define PI 3.14

int main() {
    float r;
    printf("Enter value of radius: ");
    scanf("%f", &r);
    float l;
    printf("Enter value of length: ");
    scanf("%f", &l);
    float output = PI*r*(r+l);
    printf("Output: %f", output);
    return 0;
}
Leave a Comment