C PROGRAM TO PRINT RADIUS AND VOLUME OF SPHERE
Program code:-
#include<stdio.h>
#include<math.h>
#define PI
3.14
int main()
{
float radius,sa,vol;
printf("\nEnter radius of
sphere:\n");
scanf("%f",&radius);
sa=4*PI*pow(radius,2);
vol=(sa*PI*radius)/3;
printf("\nvolume
of sphere of %f radius is %f ",radius,vol);
printf("\nsurface of sphere of %f radius
is %f",radius,sa);
return 0;
}
Output:-
tsp@ubuntu:~$gccsphere.c
- o sphere
tsp@ubuntu:~$./sphere
Enter
radius:
2
volume of
sphere of 2.000000 radius is 25.120001
surface area
of sphere of 2.000000 radius is 50.240002
In this program coding is done in the ubuntu software .It is basically used for student to use linux type operating system.Programmers can learn linux type operating system through this programs.
In this program coding is done in the ubuntu software .It is basically used for student to use linux type operating system.Programmers can learn linux type operating system through this programs.
No comments:
Post a Comment