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 by Nishu Kumari
88 articles
How to Make the CSS margin-top Style Work?
Sometimes, the margin-top in CSS doesn't work as expected. You might not see the space you want above an element, or it might not behave correctly. This can happen because of things like collapsing margins, the element's type, or how it's positioned. Our task is to show you how to make the margin-top style work using different approaches, so you can control spacing in your designs. Syntax selector { margin-top: value; } Approaches to Managing Margin-Top We'll look at different ways to manage the margin-top property and control space ...
Read MoreHow to Remove the CSS :hover Behavior from an Element?
Removing the :hover effect means stopping an element from changing its appearance when a user hovers over it. You might need to do this if the hover effect is unnecessary, distracting, or doesn't fit with the design of your page. Methods to Remove CSS :hover Behavior There are several effective ways to disable the :hover effect from elements while maintaining clean, consistent styling. Method 1: Using pointer-events: none The pointer-events: none property disables all mouse interactions, including hover effects. This completely prevents the element from responding to pointer events − ...
Read MoreAdd two unsigned numbers using bits in C++.
In this problem, we are given two unsigned numbers, and we need to add them using bits in C. Bits are binary digits that can be either 0 or 1. Unsigned numbers are positive numbers represented by these bits. To add two unsigned numbers, we add their bits one by one using binary addition rules. Syntax unsigned int addBits(unsigned int a, unsigned int b); Binary Addition Rules Binary addition works like decimal addition, but with simpler rules − 0 + 0 = 0 0 ...
Read MoreAlternate vowel and consonant string in C/C++?
We are given a string with both vowels and consonants. Our task is to rearrange it so that vowels and consonants appear alternately, while keeping their original order within their groups. This rearrangement is only possible if the number of vowels and consonants is equal, or their difference is exactly one. If multiple valid arrangements are possible, we return the one that is lexicographically smaller. Syntax char* alternateVowelConsonant(char* str); bool isVowel(char ch); Example Scenarios Scenario 1 Input: "objective" Output: "obejctive" Explanation: Vowels = [o, e, i, e], Consonants = [b, j, ...
Read MoreConvert an int to ASCII character in C/C++
In C, every character like 'A', 'b', '3', or '@' is stored as a number called its ASCII value. For example, 'A' is 65, and 'a' is 97. Given an integer like 97, we can convert it to its corresponding ASCII character which is 'a'. Syntax char character = (char)asciiValue; We can convert an integer to an ASCII character using simple methods. Here are two common approaches − Typecasting to Convert int to ASCII Character Using printf for int to ASCII Conversion Method 1: Typecasting to Convert int to ASCII Character ...
Read MoreHow to find the size of an int[] in C/C++?
In C programming, finding the size of a statically declared int[] array means determining how many elements it contains. This is different from finding the memory size − we want the element count. The sizeof operator is the primary method for this in C. Syntax int array_length = sizeof(array) / sizeof(array[0]); Method 1: Using sizeof Operator The sizeof operator returns the total memory occupied by an array in bytes. Dividing this by the size of one element gives us the number of elements. This works only for statically declared arrays − #include ...
Read MoreC++ Programs To Create Pyramid and Pattern
In this article, we will show you how to write C++ programs to create different pyramids and patterns. You can create many kinds of patterns using stars, numbers, and alphabets. Below is the list of patterns we will cover in this article- Simple Pyramid Pattern in C++ Flipped Simple Pyramid Pattern in C++ Inverted Pyramid Pattern in C++ Flipped Inverted Pyramid Pattern in C++ Triangle Pattern in C++ Inverted Triangle Pattern in C++ ...
Read MoreWrite a program in C++ to find the length of the largest subarray with zero sum
We are given an array of N integers and the task is to find the length of the longest subarray whose elements sum up to zero. A subarray is a continuous sequence of elements within the array. If no such subarray exists, return 0. Let's look at a few example scenarios to understand the problem better- Scenario 1- Input: N = 7 arr = {1, 2, -3, 3, -1, 2, -2} Output: 5 Explanation: The subarray {2, -3, 3, -1, 2} has a sum of 0 and its length is 5, which is the longest such ...
Read MoreWrite a program in C++ to find the maximum and second maximum in a given unsorted array of integers
We are given an array of unsorted integers of size N. The task is to find the distinct maximum and second maximum elements which are present in the array. The array may contain duplicate elements also, so we have to find only distinct elements. If there is no second maximum, we will return -1 for the second maximum. Let's look at some example scenarios to understand the problem clearly - Scenario 1- Input: N = 5, A[] = {2, 2, 1, 3, 4} Output: 4 and 3 Explanation: From the given array, we can see that '4' is ...
Read MoreWrite a program in C++ to check if a string can be obtained by rotating another string by two places
We are given two strings, a and b and the task is to find whether we can obtain the string b by rotating string a exactly two places in either an anticlockwise (left) or clockwise (right) direction. Let's take an example scenario to understand the problem clearly — Scenario 1- Input: a = "google", b = "legoog" Output: True Explanation: Rotating "google" two places anticlockwise gives "legoog", which matches string b. Thus, we return True. Scenario 2- Input 2: a = "tuorialst", b = "tutorials" Output: False Explanation: String "tuorialst" cannot be ...
Read More