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

Assignment 3 PDF

The document is an engineering assignment asking the student to write a C program to calculate the volume of a cylinder given its radius and height in centimeters. The program is required to: 1) Prompt the user to input the radius and height of the cylinder 2) Calculate the volume using the formula: Volume = πr^2h 3) Display the calculated volume to the user The summary provides the essential details about the programming problem and requirements in 3 sentences.

Uploaded by

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

Assignment 3 PDF

The document is an engineering assignment asking the student to write a C program to calculate the volume of a cylinder given its radius and height in centimeters. The program is required to: 1) Prompt the user to input the radius and height of the cylinder 2) Calculate the volume using the formula: Volume = πr^2h 3) Display the calculated volume to the user The summary provides the essential details about the programming problem and requirements in 3 sentences.

Uploaded by

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

FACULTY OF ENGINEERING AND LIFE SCIENCES

DEPARTMENT OF ENGINEERING
ASSIGNMENT 3

• RAMESWARAN GOPAL
NAME • (4183005701)


COURSE CODE • KFS2143

COURSE NAME COMPUTER PROGRAMMING


PUAN. ANIS SABIRIN BT
LECTURER BAHAROM
1.Calculate and display the volume of cylinder given its base radius and height in centimeters

a) Program

• b) Problems inputs

• Radius of base of cylinder (in centimeters)


• Height of cylinder ( in centimeters)

c)Problem outputs

• Volume of cylinder ( in cubic centimeters)


d) C language elements in the volume calculator program

Standard header file #include<stdio.h>

Reserved word int main()

variable float PI = 3.14159265359; /*constant*/ comments

float r, h, volume;// variable//

Standard printf("CALCULATE VOLUME OF CYLINDER(in cm^3)\n"); /* display title */


identifier

printf("\nEnter Radius of the Cylinder(cm)\n");// display radius//

scanf("%f", &r); // user input key required //

printf("Height of the Cylinder(cm)\n"); // display height//

scanf("%f", &h); // user input key required//

volume = PI * r * r * h;// volume formula used//

printf("Volume of Cylinder is %fcm^3\n", volume);//display answer//

Reserved word return (0) ; Punctuation


}
Special symbol

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy