Program to calculate value of nCr in C++

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

2K+ 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 to calculate the value of nPr in C Program

Sunidhi Bansal
Updated on 23-Sep-2019 06:32:26

332 Views

Given with the n P r, where P represents Permutation, n represents total numbers and r represents arrangement the task is to calculate the value of nPr.Permutation is the arrangement of data in a sequence or order. 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!)/(n-r)!ExampleInput-: n=5 r=2 Output-: 20AlgorithmStart Step 1 -> declare function to calculate value of nPr    int cal_n(int n)       IF n Declare function to calculate the final ... Read More

Program to Calculate the Perimeter of a Decagon in C program

Sunidhi Bansal
Updated on 20-Sep-2019 14:44:39

86 Views

What is Decagon?Given with side, the task is to calculate the perimeter of decagon. Decagon is a type of polygon with 10-sides that’s why it is also known as 10-gon polygon. It have 10 vertices and edges. A regular decagon has sides of equal length and each internal angle of degree 144.Given below is the figure of DecagonTo calculate the volume and surface area of Frustum of cone there is a formulaPerimeter = 10 * SideExampleInput-: side=10 Output-: perimeter of Decagon is : 100 Input -: side = 20 Output -: perimeter of Decagon is : 200AlgorithmStart Step 1 ... Read More

Program for Fibonacci numbers in PL/SQL

Sunidhi Bansal
Updated on 20-Sep-2019 14:39:12

8K+ Views

Given with ‘n’ numbers the task is to generate the fibonacci numbers in PL/SQL starting from 0 to n where fibonacci series of integer is in the form0, 1, 1, 2, 3, 5, 8, 13, 21, 34Where, integer 0 and 1 will have fixed space, after that two digits are added for example, 0+1=1(3rd place) 1+1=2(4th place) 2+1=3(5th place) and So onSequence F(n) of fibonacci series will have recurrence relation defined as −Fn = Fn-1 + Fn-2 Where, F(0)=0 and F(1)=1 are always fixedPL/SQL is an Oracle product which is a combination of SQL and Procedural language(PL) introduced in early ... Read More

Program for Fibonacci numbers in C

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

583 Views

Given with ‘n’ numbers the task is to generate the fibonacci series till starting from 0 to n where fibonacci series of integer is in the form0, 1, 1, 2, 3, 5, 8, 13, 21, 34Where, integer 0 and 1 will have fixed space, after that two digits are added for example, 0+1=1(3rd place) 1+1=2(4th place) 2+1=3(5th place) and So onSequence F(n) of fibonacci series will have recurrence relation defined as −Fn = Fn-1 + Fn-2 Where, F(0)=0 and F(1)=1 are always fixedThere can be multiple approaches that can be used to generate the fiboacce series −Recursive approach − in ... Read More

Program for volume of Pyramid in C++

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

696 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

143 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

391 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

331 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 the Area and Perimeter of Incircle of an Equilateral Triangle\What is Equilateral Triangle in C?

Sunidhi Bansal
Updated on 20-Sep-2019 14:02:44

117 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 regular polygonProperties of equilateral triangle are −3 sides of equal lengthInterior angles of same degree which is 60IncircleIncircle is the circle that lies inside the triangle which means the center of circle is same as of triangle as shown in the figure below. The center of incircle is known as incenter and radius is known as inradius.Given below is the figure of Incircle of ... Read More

Advertisements