Search This Blog

Thursday, 31 October 2024

1. Write a C Program to read radius and find surface area and volume of a sphere.

 

/* 1. Write a C Program to read radius and find surface area and volume of a sphere. */


#include<stdio.h>

#define PI 3.1428

void main()

{

     int radius;

     float area, volume;

     clrscr();

     printf("Enter the radius:");

     scanf("%d",&radius);

     area=4*PI*radius*radius;

     volume=4/3*PI*radius*radius*radius;

     printf("Area of Sphere=%f\n",area);

     printf("Volume of Sphere=%f\n",volume);

     getch();

}

No comments :

Post a Comment

FREE Hit Counters