/*
* 1000+ C programs + tutorials
*
*
* 15_calculate_surface_area_of_cude.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int side;
long surface_area_of_cube;
// clrscr();
printf(" Program to calculate Surface Area of a Cube : ");
printf("\n\n Enter the Side of Cube : ");
scanf("%d", &side);
surface_area_of_cube = 6*side*side;
printf("\n\n Surface area of Cude with side as %d = %ld",side,surface_area_of_cube);
// getch();
/* Result :
Program to calculate Surface Area of a Cube :
Enter the Side of Cube :
Surface area of Cude with side as 3 = 54
*/
}
-
Output :
Program to calculate Volume of a Ellipsoid :
Enter the Radius 1 of Ellipsoid : 2
Enter the Radius 2 of Ellipsoid : 4
Enter the Radius 3 of Ellipsoid : 6
Volume of Ellipsoid with (r1,r2,r3) as (2,4,6) = 150.815994
Using pow(x,y) function :
/*
* 1000+ C programs + tutorials
*
*
* 15_calculate_surface_area_of_cude.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int side;
long surface_area_of_cube;
// clrscr();
printf(" Program to calculate Surface Area of a Cube : ");
printf("\n\n Enter the Side of Cube : ");
scanf("%d", &side);
//using pow fuction
surface_area_of_cube = 6*pow(side,2);
printf("\n\n Surface area of Cude with side as %d = %ld",side,surface_area_of_cube);
// getch();
/* Result :
Program to calculate Surface Area of a Cube :
Enter the Side of Cube :
Surface area of Cude with side as 3 = 54
*/
}
-
Output :
Program to calculate Volume of a Ellipsoid :
Enter the Radius 1 of Ellipsoid : 2
Enter the Radius 2 of Ellipsoid : 4
Enter the Radius 3 of Ellipsoid : 6
Volume of Ellipsoid with (r1,r2,r3) as (2,4,6) = 150.815994
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.