Found 7197 Articles for C++

Program to calculate value of nCr in C++

Sunidhi Bansal
Updated on 23-Sep-2019 06:37:22

3K+ Views

Given with n C r, where C represents combination, n represents total numbers and r represents selection from the set, the task is to calculate the value of nCr.Combination is the selection of data from the given in a without the concern of arrangement. Permutation and combination differs in the sense that permutation is the process of arranging whereas combination is the process of selection of elements from the given set.Formula for permutation is -:nPr = (n!)/(r!*(n-r)!)ExampleInput-: n=12 r=4 Output-: value of 12c4 is :495AlgorithmStart Step 1 -> Declare function for calculating factorial    int cal_n(int n)    int temp ... Read More

Program for volume of Pyramid in C++

Sunidhi Bansal
Updated on 20-Sep-2019 14:30:34

987 Views

Given with sides depending upon the type of base of pyramid the task is to calculate the volume of pyramid.Pyramid is a 3-D figure whose outer surfaces are triangular meeting at the common point forming the sharp edge of pyramid. Volume of pyramid depends upon the type of base it will have.There are different types of base a pyramid can be made up of, like −Triangular −It means pyramid will have triangular base, than the volume of pyramid will beFormula - : (1/6) * a * b * hSquare −It means pyramid will have square base, than the volume of ... Read More

Program to calculate volume of Ellipsoid in C++

Sunidhi Bansal
Updated on 20-Sep-2019 14:25:59

244 Views

Given with r1, r2 and r3 the task is to find the volume of ellipsoid. An ellipsoid is a quadric surface, a surface that may be defined as the zero set of a polynomial of degree two in three variables. Among quadric surfaces, an ellipsoid is characterized by either of the two following properties.Formula used to calculate volume of ellipsoidVolume of Ellipsoid : (4/3) * pi * r1 * r2 * r3ExampleInput-: r1 = 6.3, r2 = 43.4, r3 = 3.7 Output-: volume of ellipsoid is : 4224.87AlgorithmStart Step 1 -> define macro as    #define pi 3.14 Step 2 ... Read More

Program for Volume and Surface area of Frustum of Cone in C++

Sunidhi Bansal
Updated on 20-Sep-2019 14:21:20

655 Views

What is Frustrum of cone?Frustum of a cone is formed by cutting the tip of a cone leaving lower and upper base known as frustum as shown in the figure. The upper base of frustum will have radius ‘r’, lower base will have radius ‘R’ with height ‘h’ and slant height ‘L’Given below is the figure of Frustrum of coneProblemGiven with slant height, height, upper base radius ‘r’ and lower radius ‘R’, the task is to calculate the volume and surface area of Frustum of cone.To calculate the volume and surface area of Frustum of cone there is a formulaVolume ... Read More

Program to calculate the area between two Concentric Circles in C++?

Sunidhi Bansal
Updated on 20-Sep-2019 14:16:10

469 Views

What is Concentric Circle?Concentric circle is the circle inside the circle which means they share common center with different radius lengths i.e. r1 and r2 where, r2>r1. Region between two concentric circles is known as annulus.Given below is the figure of Concentric CircleProblemGiven with two concentric circles of different radius lengths r1 and r2 where r2>r1. The task is to find the area between both the circles which is highlighted by the blue colour.To calculate area between two circles we can subtract the area of larger circle from smaller circleLets say, bigger circle have radius r2 and smaller circle have ... Read More

Program to calculate area of Circumcircle of an Equilateral Triangle in C++

Sunidhi Bansal
Updated on 20-Sep-2019 13:56:40

240 Views

As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regular polygonProperties of equilateral triangle are3 sides of equal lengthInterior angles of same degree which is 60Circumcircle of a plygon is the circle that passes through all the vertices of a polygon. The radius of circle can be an edge or side of polygon inside the circle which is known as circumradius and center of circle is known as circumcenter. It can be inside or outside of ... Read More

Program to calculate area and perimeter of equilateral triangle in C++

Sunidhi Bansal
Updated on 20-Sep-2019 13:49:21

415 Views

What is Equilateral Triangle?As the name suggests, equilateral triangle is the one that have equal sides and also it have equal interior angles of 60° each. It is also known as regular triangle because it’s a regularpolygonProperties of equilateral triangle are −3 sides of equal lengthInterior angles of same degree which is 60Given below is the figure of equilateral triangleProblemGiven with the side of equilateral triangle the task is to find the area and perimeter of a triangle where area is the space occupied by the shape and perimeter is the space occupied by its boundaries.To calculate area and perimeter ... Read More

Program for Volume and Surface Area of Cuboid in C++

Sunidhi Bansal
Updated on 20-Sep-2019 12:36:32

767 Views

What is cuboid?Cuboid is a three-dimensional object with six faces of rectangle shape which means it has sides of different length and breadth. The difference between a cube and cuboid is that a cube has equal length, height and breadth whereas in cuboids these three are not sameProperties of cuboid are −six faces12 edges8 verticesGiven below is the figure of cubeProblemGiven with the length, width and volume, the task is to find the total surface area and volume of a cuboid where surface area is the space occupied by the faces and volume is the space that a shape can ... Read More

Program for Volume and Surface Area of Cube in C++

Sunidhi Bansal
Updated on 20-Sep-2019 12:08:08

895 Views

What is cube?Cube is a three-dimensional object with six faces of square shape which means it has sides of same length and breadth. Cube is the only regular hexahedron with following properties −six faces12 edges8 verticesGiven below is the figure of cubeProblemGiven with the side, the task is to find the total surface area and volume of a cube where surface area is the space occupied by the faces and volume is the space that a shape can contain.To calculate surface area and volume of a cube there is a formula −Surface Area = 6*Side*sideVolume = Side*side*sideExampleInput-: side=3 Output-: volume ... Read More

Program for Surface Area of Octahedron in C++

Sunidhi Bansal
Updated on 20-Sep-2019 12:02:36

206 Views

What is Octahedron?The word ‘dodecahedron’ is derived from the Greek words where, Octa means ‘Eight’ and hedron specifies ‘faces’. octahedron in geometric is a 3-D platonic or regular solid with eight faces. Like, other figures octahedrons also have properties and that are −6 polyhedron vertices12 polyhedron edges8 equilateral facesGiven below is the figure of octahedronProblemGiven with the sides, the program must find the surface area of octahedron where surface area is the total space occupied by the faces of the given figure.To calculate surface area of octahedron there is a formula −Where, a is side of an OctahedronExampleInput-: side=5 Output-: ... Read More

Advertisements