Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Programming Articles
Page 2433 of 2547
Program for Markov matrix in C++
Given a matrix M[r][c] with 'r' number of rows and 'c' number of columns, we have to check that the given matrix is Markov matrix or not. If the input matrix is Markov matrix then print the output "It is a Markov matrix" and "it's not an Markov matrix" if it is not a Markov matrix. Markov Matrix Now, what is Markov Matrix? A matrix M is a Markov matrix if and only if its sum of each row is equal to only 1. Like in the given example below − $$\begin{bmatrix}0.2 & 0.3 & 0.5 ...
Read MoreProgram to check if matrix is upper triangular in C++
Given a square matrix M[r][c] where 'r' is some number of rows and 'c' are columns such that r = c, we have to check that 'M' is upper triangular matrix or not. Upper Triangular Matrix Upper triangular matrix is a matrix in which the elements above the main diagonal(including the main diagonal) are not zero and below elements are zero only. Like in the given Example below − In above figure the red highlighted elements are lower elements from the main diagonal which are zero and rest elements are non-zero. Example ...
Read MoreProgram to check if matrix is lower triangular in C++
Given a square matrix M[r][c] where 'r' is some number of rows and 'c' are columns such that r = c, we have to check that 'M' is lower triangular matrix or not. Lower Triangular Matrix − Lower triangular matrix is a matrix in which the elements below the main diagonal(including the main diagonal) are not zero and above elements are zero only. Like in the given Example below − In above figure the red highlighted elements are upper elements from the main diagonal which are zero and rest elements are non-zero. Example ...
Read MoreProgram to check Involutory Matrix in C++
Given a matrix M[r][c], 'r' denotes number of rows and 'c' denotes number of columns such that r = c forming a square matrix. We have to check whether the given square matrix is an Involutory matrix or not. Involutory Matrix A matrix is called Involutory matrix if and only if, when a matrix gets multiplied with itself and its result is an identity matrix. A matrix I is Identity matrix if and only if its main diagonal is one and other elements than the main diagonal are zero. So, we can say a matrix is Involutory matrix ...
Read MoreProgram to check idempotent matrix in C++
Given a matrix M[r][c], 'r' denotes number of rows and 'c' denotes number of columns such that r = c forming a square matrix. We have to check whether the given square matrix is an Idempotent matrix or not. Idempotent Matrix A matrix 'M' is called Idempotent matrix if and only the matrix 'M' multiplied by itself returns the same matrix 'M' i.e. M * M = M. Like in the given example below − We can say that the above matrix is multiplied by itself and returns the same matrix; hence the matrix ...
Read MoreProgram to check diagonal matrix and scalar matrix in C++
Given a matrix M[r][c], 'r' denotes number of rows and 'c' denotes number of columns such that r = c forming a square matrix. We have to find whether the given square matrix is diagonal and scalar matrix or not, if it is diagonal and scalar matrix then print yes in the result. Diagonal matrix A square matrix m[][] will be diagonal matrix if and only if the elements of the except the main diagonal are zero. Like in the given figure below − Here, the elements in the red are main diagonal which ...
Read MoreProgram to calculate value of nCr in C++
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)!) Example Input-: n=12 r=4 Output-: value of 12c4 is :495 Algorithm Start Step 1 -> Declare function for calculating factorial ...
Read MoreProgram for volume of Pyramid in C++
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 MoreProgram to calculate volume of Ellipsoid in C++
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 MoreProgram to calculate the area between two Concentric Circles in C++?
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