C++ Programming Code Examples
C++ > Mathematics Code Examples
program in C++ to display the n terms of even natural number and their sum.
Finds First Occurence of the any Character -
Program takes 2 strings as input and finds the first occurence of the any character of String2 in String1 & also its position. Take two strings as input. Compare both the strings using two
Checking Singly Linked List is Palindrome -
C Program checks whether the Singly Linked list is a palindrome. A Palindrome is a Pattern in List in which the contents when read from front is the same as when read from last. So
C++ Multiply Two Matrices use 2D Arrays -
C++ Code is very simple it takes input in two 2D arrays each with size of 2X2. After taking the input program "multiply two matrix" in 3 nested for loops. Size of arrays is defined use
Whether entered Matrix is Magic Square -
A magic square is a simple mathematical game developed during the 1500. Square is divided into equal number of rows and columns. Start filling each square with the
C Check if the Matrix is an Identity Matrix -
C code checks a given Matrix is an Identity Matrix. Identity matrix is a square matrix with 1's along the diagonal from upper left to lower right and 0's in all other positions. If it
C++ Programming & Shell Sort Algorithm -
"Shellsort", also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a 'Generalization of Sorting' by exchange or 'sorting by insertion'. Method
Calculate Addition or Subtraction & Trace -
Calculate the addition or subtraction & trace of 2 matrices. Here trace of the matrix is the sum of the elements on the main diagonal i.e the diagonal from the upper left to the lower
C Program to calculate Area of a Polygon -
Given the coordinates of the vertices of a convex polygon, calculate its area and perimeter. Subdivide it into triangles and calculate the area of each triangle with the