develop a VI that computes the surface area and volume Devel
Solution
c pgm:
#include <stdio.h>
#include <math.h>
int main()
{
float radius;
float surface_area, volume;
printf(\"Enter radius : \");
scanf(\"%f\", &radius);
surface_area = 4 * (22/7) * radius * radius;
volume = (4.0/3) * (22/7) * radius * radius * radius;
printf(\"Surface area of sphere is: %.3f\", surface_area);
printf(\"\ Volume of sphere is : %.3f\", volume);
return 0;
}
java code:
public class Sphere {
public static void main(String[] args) {
final double PI = 3.14159;
double radius;
double surface_Area, volume_sphere;
System.out.print(\"Enter the radius : \");
Scanner input = new Scanner(System.in);
radius = input.nextDouble();
surface_Area = 4 * PI * radius * radius;
volume_sphere = (4.0 / 3.0) * PI * radius * radius * radius;
System.out.println(\" radius \" + radius + \",surface area is \" + surfaceArea + \"volume is \"
+ volume_sphere + \".\");
}
}
