Programming Articles

Page 973 of 2547

Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 193 Views

Here we will see how to find the area of a square inscribed in a circle, which is itself inscribed in a hexagon. Let's say the side of the hexagon is 'A', the radius of the inscribed circle is 'r', and the side of the square is 'a'. A r a Mathematical Relationship For a regular hexagon with side A, the radius of the inscribed ...

Read More

Angle between two Planes in 3D in C Program?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 290 Views

In 3D geometry, planes are flat surfaces extending infinitely in space. When two planes intersect, they form a line, and the angle between them becomes an important geometric measure. The angle between two planes is calculated using their normal vectors and the dot product formula. Syntax angle = acos(dot_product / (magnitude1 * magnitude2)) * (180 / PI) Plane Equations Two planes in 3D space can be represented by the following general equations − P1: a1 * x + b1 * y + c1 * z + d1 = 0 P2: ...

Read More

Alphanumeric Abbreviations of a String in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 640 Views

In C programming, generating alphanumeric abbreviations of a string means creating all possible combinations where some characters can be replaced with numbers representing the count of omitted characters. For example, "HELLO" can be abbreviated as "HE2O" where "2" represents the two omitted characters "LL". Syntax void printAbbreviation(const char* s, int index, int max_index, char* str, int str_len); Algorithm The recursive algorithm works as follows − printAbbreviation(s, index, max, str) − begin if index is same as max, then print str ...

Read More

C Program to Find the minimum sum of factors of a number?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 494 Views

The minimum sum of factors of a number is the sum of all prime factors (with repetition) of that number. This approach decomposes the number into its smallest possible factors, which are prime numbers, resulting in the minimum possible sum. Syntax int findMinSumOfFactors(int n); Explanation To find the minimum sum of factors, we need to find all possible ways to factorize the number and compare their sums. The minimum sum is always achieved by using prime factorization − Input: n=12 Output: 7 Following are different ways to factorize 12 and ...

Read More

C Program to Compute Quotient and Remainder?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 502 Views

Given two numbers dividend and divisor, we need to write a C program to find the quotient and remainder when the dividend is divided by the divisor. In division, we see the relationship between the dividend, divisor, quotient, and remainder. The number which we divide is called the dividend. The number by which we divide is called the divisor. The result obtained is called the quotient. The number left over is called the remainder. 55 ÷ 9 = 6 and 1 Dividend Divisor Quotient Remainder Syntax quotient = dividend / divisor; remainder = ...

Read More

C Program To Check whether Matrix is Skew Symmetric or not?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 4K+ Views

A square matrix A is said to be skew-symmetric if Aij = −Aji for all i and j. In other words, a matrix A is skew-symmetric if the transpose of matrix A equals the negative of matrix A (AT = −A). Note that all main diagonal elements in a skew-symmetric matrix are zero. Syntax // Check if matrix[i][j] == -matrix[j][i] for all i, j if (A[i][j] == -A[j][i]) { // Matrix is skew-symmetric } Example Matrix Let's take an example of a 3×3 matrix − A = ...

Read More

C Program for Rat in a Maze - Backtracking-2?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 3K+ Views

Rat in a maze is a popular problem that utilizes backtracking algorithm. In this problem, we have a 2D matrix representing a maze where some cells are blocked and we need to find a path from source to destination. A maze is a 2D matrix in which some cells are blocked. One of the cells is the source cell, from where we have to start, and another is the destination where we have to reach. We must find a path from source to destination without moving into any blocked cells. Input Maze: ...

Read More

C Program to Check if count of divisors is even or odd?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 539 Views

Given a number “n” as an input, this program finds whether the total number of divisors of n is even or odd. A divisor of a number is any integer that divides the number without leaving a remainder. An even number is an integer that is exactly divisible by 2. Example: 0, 8, -24 An odd number is an integer that is not exactly divisible by 2. Example: 1, 7, -11, 15 Syntax // Count divisors and check if count is even or odd for (int i = 1; i

Read More

C Program for array rotation?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 4K+ Views

Array rotation is a fundamental operation where elements of an array are shifted to the left or right by a specified number of positions. In left rotation, elements move left and the leftmost elements wrap around to the end. Left Rotation by 3 positions Original: 1 2 3 4 ...

Read More

C Program for Pancake sorting?

sudhir sharma
sudhir sharma
Updated on 15-Mar-2026 338 Views

Pancake sorting is a variation of the sorting problem where the only allowed operation is to reverse elements of some prefix of the sequence. It's named after the problem of sorting a stack of pancakes using a spatula that can flip all pancakes above any insertion point. Syntax void pancakeSort(int arr[], int n); void flip(int arr[], int i); How Pancake Sort Works The algorithm works by repeatedly finding the maximum element in the unsorted portion and moving it to its correct position using at most two flip operations − Step 1: Find ...

Read More
Showing 9721–9730 of 25,466 articles
« Prev 1 971 972 973 974 975 2547 Next »
Advertisements