🚀 Day 5 – Calculating the Volume of a Cylinder in C

 🚀 Day 5 – Calculating the Volume of a Cylinder in C


Hello readers,

I am Mayur Gund, a first-year Computer Science & Engineering student at Sanjivani College of Engineering. Through this blog, I’m documenting my daily coding journey as I learn programming step by step. My aim is to share not just the code, but also my learnings, reflections, and growth as an engineer.


 ✨Today’s Program :

On Day 5, I wrote a C program to calculate the volume of a cylinder 📏.

Formula Used : 𝑉𝑜𝑙𝑢𝑚𝑒 = 𝜋×𝑟^2×ℎ


🖥️ C Code Snippet : 


#include <stdio.h>

int main() {

    /*

    Program : To calculate the volume of a cylinder

    Author : Mayur B Gund

    Date : 09/09/2025

    Day : 05

    */


    float r, h;

    printf("The program is designed to calculate the volume of a cylinder\n\n");

    printf("Enter the radius of the cylinder (in cm): ");

    scanf("%f", &r);

    printf("Enter the height of the cylinder (in cm): ");

    scanf("%f", &h);

    float volume = 3.14 * r * r * h;

    printf("\nThe volume of the cylinder is: %f cubic cm\n", volume);

    printf("\nThis program calculates with 100 percent accuracy. It is used to calculate the volume of a cylinder when radius and height are known.\n");

    return 0;

}


⚙️ Key Learnings Today :

  • Taking multiple inputs using scanf
  • Using floating-point variables for accurate results
  • Applying mathematical formulas directly in code
  • Better understanding of how to format outputs for readability


💡 Reflection :


Today’s program was a bridge between geometry and programming. It felt exciting to bring a formula I learned in school into the programming world. This exercise gave me more confidence in handling real-world problems through logic and code.


Every day adds a small block to my foundation in programming — and I can already see myself improving both in coding and problem-solving.


✅ Tomorrow, I’ll continue with another program to strengthen my basics and problem-solving skills in C.


Output of program



Code snippet

Code snippet






Also read :

Comments

Popular posts from this blog

The Boy Behind the Percentile: A Memory of 12:07 AM

🚀 Back on Track: Powering Up After Exams!

Scholar Desk : The Ego Issue