Computer Science, asked by AlizaFarooqui, 1 year ago

write a program which calculates the surface area and volume of a cylinder


AlizaFarooqui: please answer fast
Anonymous: of which language??
AlizaFarooqui: java
Anonymous: oooh
Anonymous: m sry mine is c++
AlizaFarooqui: it's ok
Anonymous: thanks

Answers

Answered by Anonymous
5

import java.util.*;

class cylinder

{public static void main()

{

  Scanner sc= new Scanner(System.in);

System.out.println("Enter the radius of the cylinder");

double r=sc.nextDouble();

System.out.println("Enter the height of the cylinder");

double h=sc.nextDouble();

double pi=3.14;

double v=pi*r*r*h;

double sa=(2*pi*r*h)+(2*pi*r*r);

System.out.println("The volume of the cylinder is "+v);

System.out.println("The surface area of the cylinder is "+sa);

}

}


AlizaFarooqui: thanks ri
AlizaFarooqui: miss riya
Anonymous: Your welcome
Anonymous: Pls mark me as the brainliest
AlizaFarooqui: sry I am new in brainly so I didn't know how to mark
Anonymous: Beneath my answer, there might be an option of mark brainliest
Anonymous: If it's there, pls do it
Anonymous: If it's not, then it will come in a few days
AlizaFarooqui: ok
Similar questions