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
C Program for diamond pattern with different layers
A diamond pattern in C is a symmetric arrangement of numbers that forms a diamond shape. The pattern starts with a single digit at the top, expands to show increasing sequences in the middle, and then contracts back to a single digit at the bottom. Syntax void print_pattern(int n); Approach The algorithm for creating a diamond pattern with n layers follows these steps − The pattern has (2 * n + 1) total rows First and last rows contain only "0" with proper spacing For rows 1 to n-1: numbers increase from ...
Read MoreCSS overflow: scroll
The CSS overflow: scroll property forces the display of scrollbars when content exceeds the dimensions of its container. Unlike other overflow values, scroll always shows scrollbars regardless of whether the content actually overflows. Syntax selector { overflow: scroll; } How It Works When you set overflow: scroll, the browser will − Clip any content that exceeds the container's dimensions Always display both horizontal and vertical scrollbars Allow users to scroll through the hidden content Example The following example demonstrates overflow: scroll with content that exceeds ...
Read MoreC Program to add two fractions
Given with the input as fraction i.e. a/b and c/d where a, b, c and d can be any integer values other than 0 and the task is to add these two fraction to generate their final sum. Fractions are represented by − a / b, where a is known as numerator and b is known as denominator. a and b can have any numeric values but b can have any numeric value other than 0. Sum of two fractions is represented as a / b + c / d, and the rule for adding the two ...
Read MoreCenter links in a Navigation Bar with CSS
One of the most crucial components of a website or application is the navigation bar. It usually sits at the top of your application and makes it simple for users to navigate to the most important sections or pages of your website. The major sections of your website are essentially linked from a navbar. These links are commonly known as navigation items, and you can align them to the left, center, or right based on your design requirements. Syntax /* Method 1: Using Flexbox */ nav { display: flex; ...
Read MoreC program to calculate distance between two points
Given two points with coordinates, we need to calculate the distance between them. In a two-dimensional plane, if we have points A and B with coordinates (x1, y1) and (x2, y2) respectively, we can find the distance using the Euclidean distance formula. Syntax distance = sqrt((x2 - x1)² + (y2 - y1)²) Distance Formula The distance between two points is calculated using the formula − ...
Read MoreOverlap Elements with CSS
To overlap elements in CSS, you need to control their stacking order using positioning and the z-index property. Elements with higher z-index values appear in front of elements with lower values. Syntax selector { position: relative | absolute | fixed; z-index: integer; } Key Properties for Overlapping PropertyDescription positionMust be relative, absolute, or fixed for z-index to work z-indexControls stacking order (higher values appear on top) top, left, right, bottomControls precise positioning of overlapping elements Example: Image Behind Text The following example ...
Read MoreC program to calculate distance between three points in 3D
In C programming, calculating the distance between two points in 3D space is a common geometric problem. The distance between two points in three-dimensional space can be calculated using the Euclidean distance formula. Syntax distance = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2) + pow(z2-z1, 2)); Where (x1, y1, z1) and (x2, y2, z2) are the coordinates of the two points in 3D space. Formula The mathematical formula for calculating distance between two points in 3D space is − Distance = √[(x2-x1)² + (y2-y1)² + (z2-z1)²] ...
Read MoreCSS position: relative;
The CSS position: relative property allows you to position an element relative to its normal position in the document flow. The element maintains its original space in the layout, but you can offset it using the top, right, bottom, and left properties. Syntax selector { position: relative; top: value; right: value; bottom: value; left: value; } Key Characteristics When an element has position: relative − It remains in the normal document flow Other ...
Read MoreC program to calculate age
Calculating age is a common programming task that requires handling date arithmetic carefully. This involves computing the difference between two dates while accounting for varying month lengths and leap years. Syntax void calculateAge(int currentDay, int currentMonth, int currentYear, int birthDay, int birthMonth, int birthYear); Algorithm The age calculation follows these steps − If the current day is less than birth day, borrow days from the previous month If the current month is less ...
Read MoreCSS position: static;
The CSS position: static property sets an element to its normal position in the document flow. This is the default positioning behavior for all HTML elements. Syntax selector { position: static; } Key Characteristics Elements with position: static have these characteristics − They follow the normal document flow The top, bottom, left, and right properties have no effect They cannot be moved using positioning properties This is the default value for all elements Example The following example demonstrates static positioning behavior − ...
Read More