program to obtain radius and height of a cylinders and find its surface area
Answers
Answer:
Python
r = 2.0 #radius
h = 5.0 #height
surfacearea = (2*22*(r + h))/7 #calculation
print ("Surface Area Of Cylinder : ");
print (surfacearea); #prints surface area
Output:
Surface Area Of Cylinder : 44.0
C
#include<stdio.h>
int main()
{
float r, h, surfacearea;
r=2.0;
h = 5.0;
surfacearea = (2*22*(r + h))/7;
printf("\n\n Surface Area of Cylinder is : %f", surfacearea);
return (0);
}
Output:
Surface Area of Cylinder is: 44.00000
JAVA
public class test
{
public static void main(String args[])
{
float r, h, surfacearea;
r = 2;
h = 5;
surfacearea = (22*r*(r+h))/7;
System.out.println("Surface Area of Cylinder is: "+surfacearea);
}
}
Output:
Surface Area of Cylinder is: 44.000000
C#
using System;
class Program
{
static void Main()
{
float r, h, surfacearea;
r = 2;
h = 5;
surfacearea = (22*r*(r+h))/7;
Console.WriteLine("Surface Area of Cylinder is:"+surfacearea);
}
}
Output:
Surface Area of Cylinder is: 44