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
Articles on Trending Technologies
Technical articles with clear explanations and examples
Add minimum number to an array so that the sum becomes even in C programming
Given an array, we need to add the minimum positive number to make the sum of all array elements even. The key insight is that we only need to analyze the parity (odd/even nature) of numbers to determine the minimum addition required. Syntax int findMinimumToAdd(int arr[], int n); Method 1: Calculate Total Sum Calculate the sum of all elements in the array, then check if the sum is even. If the sum is already even, add 2 (minimum positive even number). If the sum is odd, add 1 to make it even − ...
Read MoreConvert the colors of the object to 256 shades of gray with CSS
The CSS grayscale() filter is used to convert the colors of an element to 256 shades of gray. This filter is part of the CSS filter property and allows you to remove color saturation from images, text, and other elements. Syntax selector { filter: grayscale(value); } Possible Values ValueDescription 0 or 0%No grayscale effect (original colors) 1 or 100%Completely grayscale (no color) 0.5 or 50%50% grayscale effect Example: Grayscale Effect on Image and Text The following example applies a grayscale filter to both an image and ...
Read MoreArithmetic Mean in C programming
Arithmetic mean is the sum of a collection of numbers divided by the number of numbers in the collection. It is one of the most commonly used measures of central tendency in statistics and mathematics. Syntax mean = (sum of all numbers) / (count of numbers) Basic Properties of Arithmetic Mean If each observation is increased by p, the mean increases by p. If each observation is decreased by p, the mean decreases by p. If each observation is multiplied by p, the mean is multiplied by p. If each observation is divided ...
Read MoreFade In Up Animation Effect with CSS
The CSS fade in up animation effect creates a smooth transition where an element starts invisible and positioned below its final location, then gradually appears while moving upward to its intended position. This creates an elegant entrance animation commonly used in modern web design. Syntax @keyframes fadeInUp { 0% { opacity: 0; transform: translate3d(0, 100%, 0); } 100% { opacity: 1; ...
Read MoreC/C++ Program for nth Catalan Number?
Catalan numbers are a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. The nth Catalan number can be calculated using the recursive formula or dynamic programming approaches. Syntax C(n) = (2n)! / ((n+1)! * n!) C(n) = C(0)*C(n-1) + C(1)*C(n-2) + ... + C(n-1)*C(0) Mathematical Properties Catalan numbers have several interpretations − Cn is the number of Dyck words of length 2n (strings with n X's and n Y's where no prefix has more Y's than X's) Cn counts valid parentheses combinations with n pairs Cn ...
Read MoreCreate a mirror image with CSS
The CSS mirror effect can be created using the transform property with scale() function. By applying negative values to the scale function, you can flip elements horizontally or vertically to create mirror images. Syntax /* Horizontal mirror (flip left-right) */ transform: scaleX(-1); /* Vertical mirror (flip top-bottom) */ transform: scaleY(-1); /* Both horizontal and vertical mirror */ transform: scale(-1, -1); Possible Values FunctionDescription scaleX(-1)Creates a horizontal mirror image (flips left to right) scaleY(-1)Creates a vertical mirror image (flips top to bottom) scale(-1, -1)Creates both horizontal and vertical mirror image ...
Read MoreC Program to Multiply two Floating Point Numbers?
In C, multiplying two floating-point numbers is a fundamental arithmetic operation. Floating-point numbers can represent real numbers with decimal points, such as 4320.0, -3.33, or 0.01226. The term "floating point" refers to the fact that the decimal point can "float" to support a variable number of digits before and after it. Syntax float result = float_num1 * float_num2; double result = double_num1 * double_num2; Floating Point Data Types Type Size Range Precision float 4 bytes ±1.18 x 10-38 to ±3.4 x 1038 6-7 digits double ...
Read MoreC Program to Check if a Given String is a Palindrome?
A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward. Words such as "madam" or "racecar" or the number "10801" are palindromes. To check if a string is a palindrome, we need to compare characters from both ends moving toward the center. If the first character matches the last, second matches second-last, and so on, then the string is a palindrome. Syntax int isPalindrome(char str[]); // Returns 1 if palindrome, 0 otherwise Example 1: Using Character Comparison This approach compares characters from both ends ...
Read MoreFade Out Down Animation Effect with CSS
The fade out down animation effect makes an element gradually disappear while moving downward. This creates a smooth exit animation that combines opacity reduction with downward translation. Syntax @keyframes fadeOutDown { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(distance); } } .element { ...
Read MoreWrite a program to Delete a Tree in C programming
To delete a tree in C programming, we need to traverse each node and free the memory allocated to them. The key is to delete nodes in the correct order − children must be deleted before their parents to avoid memory leaks and dangling pointers. Post-order traversal is ideal for this operation as it visits children before the parent node. Syntax void deleteTree(struct node* root) { if (root == NULL) return; deleteTree(root->left); deleteTree(root->right); free(root); } How Post-order Traversal Works ...
Read More