0% found this document useful (0 votes)
0 views

Sum - C Program

The document contains C programs that calculate various geometric properties of circles, spheres, hemispheres, and cylinders. Each program prompts the user for the radius (and height where applicable) and computes the area, circumference, volume, or surface area based on the provided formulas. The programs utilize the constant PI defined as 3.14.

Uploaded by

yesudossj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Sum - C Program

The document contains C programs that calculate various geometric properties of circles, spheres, hemispheres, and cylinders. Each program prompts the user for the radius (and height where applicable) and computes the area, circumference, volume, or surface area based on the provided formulas. The programs utilize the constant PI defined as 3.14.

Uploaded by

yesudossj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Area of a Circle

#include <stdio.h>
#define PI 3.14

int main() {
float radius, area;
printf("Enter radius: ");
scanf("%f", &radius);
area = PI * radius * radius;
printf("Area of Circle = %.2f\n", area);
return 0;
}

✅ 2. Circumference of a Circle

#include <stdio.h>
#define PI 3.14

int main() {
float radius, circumference;
printf("Enter radius: ");
scanf("%f", &radius);
circumference = 2 * PI * radius;
printf("Circumference = %.2f\n", circumference);
return 0;
}

✅ 3. Diameter of a Circle

#include <stdio.h>

int main() {
float radius, diameter;
printf("Enter radius: ");
scanf("%f", &radius);
diameter = 2 * radius;
printf("Diameter = %.2f\n", diameter);
return 0;
}

✅ 4. Area of a Sphere

#include <stdio.h>
#define PI 3.14
int main() {
float radius, area;
printf("Enter radius: ");
scanf("%f", &radius);
area = 4 * PI * radius * radius;
printf("Surface Area of Sphere = %.2f\n", area);
return 0;
}

✅ 5. Volume of a Sphere

#include <stdio.h>
#define PI 3.14

int main() {
float radius, volume;
printf("Enter radius: ");
scanf("%f", &radius);
volume = (4.0 / 3) * PI * radius * radius * radius;
printf("Volume of Sphere = %.2f\n", volume);
return 0;
}

✅ 6. Area of a Hemisphere

#include <stdio.h>
#define PI 3.14

int main() {
float radius, area;
printf("Enter radius: ");
scanf("%f", &radius);
area = 3 * PI * radius * radius;
printf("Surface Area of Hemisphere = %.2f\n", area);
return 0;
}

✅ 7. Volume of a Hemisphere

#include <stdio.h>
#define PI 3.14

int main() {
float radius, volume;
printf("Enter radius: ");
scanf("%f", &radius);
volume = (2.0 / 3) * PI * radius * radius * radius;
printf("Volume of Hemisphere = %.2f\n", volume);
return 0;
}

✅ 8. Volume of a Cylinder

#include <stdio.h>
#define PI 3.14

int main() {
float radius, height, volume;
printf("Enter radius and height: ");
scanf("%f %f", &radius, &height);
volume = PI * radius * radius * height;
printf("Volume of Cylinder = %.2f\n", volume);
return 0;
}

✅ 9. Surface Area of Cylinder

#include <stdio.h>
#define PI 3.14

int main() {
float radius, height, area;
printf("Enter radius and height: ");
scanf("%f %f", &radius, &height);
area = 2 * PI * radius * (radius + height);
printf("Surface Area of Cylinder = %.2f\n", area);
return 0;
}

✅ 10. Lateral Surface Area of Cylinder

#include <stdio.h>
#define PI 3.14

int main() {
float radius, height, lateralArea;
printf("Enter radius and height: ");
scanf("%f %f", &radius, &height);
lateralArea = 2 * PI * radius * height;
printf("Lateral Surface Area = %.2f\n", lateralArea);
return 0;
}

You might also like