Computer Science, asked by nikoncraft2006, 4 months ago

answer batao ;-; plz

Attachments:

Answers

Answered by brainlistpro
0

int r = 5 ;

int h = 6 ;

float pi = 22/7 ;

public void calc(){

float ar = (pi*r*r) + (2*pi*r*h) ;

System.out.println(ar) ;

}

Answered by Oreki
2

Program

import java.util.Scanner;

public class SurfaceArea {

   public static void main(String[ ] args) {

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter :\n Radius - ");

       double radius = sc.nextDouble( );

       System.out.print(" Height - ");

       double height = sc.nextDouble( ),

                    surfaceArea = Math.PI * radius * radius + 2 * Math.PI * radius * height;

       System.out.println("Surface area - " + surfaceArea + " unit square");

   }

}

Algorithm

  • Accepting the radius and height from the user using Scanner class.
  • Calculating the surface area of a cylinder using the provided formula.
  • Displaying the surface area of the cylinder.
Attachments:
Similar questions