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 to find frequency of each digit in a string
In C, finding the frequency of each digit in a string involves scanning through the string character by character and counting occurrences of digits (0-9). We use an array to store the frequency count for each digit. Syntax int freq[10] = {0}; // Array to store frequency of digits 0-9 if (str[i] >= '0' && str[i] = '0' && s[i] 0) { printf("(Number %d, Freq %d)", i, freq[i]); } } } ...
Read MoreHow to create image overlay hover effect with CSS?
The image overlay effect on hover is hidden when the page loads and becomes visible when the mouse cursor is hovered over the image. The smooth transition effect is achieved using the CSS transition property combined with opacity and position properties. Syntax .overlay { transition: duration ease; opacity: 0; position: absolute; } .container:hover .overlay { opacity: 1; } Method 1: Basic Overlay with Text This method creates a simple text overlay that appears centered over the image ...
Read MoreC program to print string tokens
In C, string tokenization is the process of breaking a string into smaller parts (tokens) based on specified delimiters. The strtok() function from the string.h library is commonly used for this purpose. Syntax char *strtok(char *str, const char *delim); Parameters str − The string to be tokenized (NULL for subsequent calls) delim − A string containing the delimiter characters How It Works The strtok() function works by following these steps − First call: Pass the string and delimiter to get the first token Subsequent calls: Pass NULL as ...
Read MoreHow to create a tabbed image gallery with CSS and JavaScript?
A tabbed image gallery allows users to click on small thumbnail images to view them in a larger format. This creates an interactive way to display multiple images without taking up too much page space initially. Let us see how to create a tabbed image gallery using CSS and JavaScript. Syntax /* Basic thumbnail styling */ .thumbnail { cursor: pointer; transition: transform 0.3s; } /* Modal container */ .modal { display: none; position: fixed; z-index: 1000; ...
Read MoreC program to dynamically make array and print elements sum
In C programming, dynamic memory allocation allows us to create arrays of variable size at runtime. This is useful when we don't know the array size at compile time. We use malloc() or calloc() functions from the stdlib.h header to allocate memory dynamically. So, if the input is like n = 6, and array elements 9, 8, 7, 2, 4, 3, then the output will be 33 because sum of 9 + 8 + 7 + 2 + 4 + 3 = 33. Syntax int *arr = (int*) malloc(size * sizeof(int)); int *arr = (int*) calloc(size, ...
Read MoreC program to find amount of volume passed through a tunnel
In C programming, we can solve problems involving conditional volume calculations using structures and functions. This program determines which boxes can pass through a tunnel based on height restrictions and calculates their volumes. Syntax struct Box { int length, width, height; }; int volume(struct Box box); int canPass(struct Box box, int tunnelHeight); Problem Description Given a tunnel with height 41 and unlimited width, we need to find the total volume of boxes that can pass through it. A box can pass if its height is strictly less than the ...
Read MoreHow to create a responsive Image Grid with HTML and CSS?
A responsive image grid displays images in a grid layout that adapts to different screen sizes. Using CSS flexbox, we can create a flexible grid system that automatically adjusts the number of columns based on the viewport width. Syntax /* Outer grid container */ .outer-grid { display: flex; flex-wrap: wrap; } /* Inner grid columns */ .inner-grid { flex: percentage; max-width: percentage; } /* Responsive breakpoints */ @media screen and (max-width: breakpoint) { /* Responsive ...
Read MoreC program to find marks of students for boys or girls
In C programming, we can solve problems involving array processing based on index patterns. This program calculates the sum of marks for either boys or girls, where boys' marks are stored at even indices (0, 2, 4, ...) and girls' marks are stored at odd indices (1, 3, 5, ...). Syntax int calculateMarks(int marks[], int n, char gender); Algorithm To solve this problem, we follow these steps − Initialize g_sum and b_sum to 0 Iterate through the array from index 0 to n-1 If index is odd, add marks to g_sum (girls) ...
Read MoreHow to create a modal image gallery with CSS and JavaScript?
A modal image gallery allows users to view thumbnail images and click on them to open a larger version in a modal overlay. This creates an elegant way to showcase multiple images without cluttering the page layout. Syntax /* Modal container */ .modal { display: none; position: fixed; z-index: 1; background-color: rgba(0, 0, 0, 0.9); } /* Modal image */ .modalImage { display: block; margin: auto; } Example The ...
Read MoreC program to find nth term of given recurrence relation
In C programming, we can find the nth term of a given recurrence relation where each term is the sum of the previous three terms. This type of recurrence relation follows the pattern S(n) = S(n-1) + S(n-2) + S(n-3) for n > 3, with given base cases. Syntax int solve(int a, int b, int c, int n); Recurrence Relation Definition The recurrence relation is defined as follows − S(1) = a (first base case) S(2) = b (second base case) S(3) = c (third base case) S(n) = S(n-1) + S(n-2) ...
Read More