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 sum of digits of a five digit number
In C programming, finding the sum of digits of a five-digit number involves extracting each digit and adding them together. We use the modulo operator (%) to extract the last digit and integer division (/) to remove it from the number. Syntax int digitSum = 0; while (number != 0) { digitSum += number % 10; number /= 10; } So, if the input is like num = 58612, then the output will be 22 because 5 + 8 + 6 + 1 + 2 = 22. ...
Read MoreHow to create a responsive header with CSS?
A responsive header is a navigation bar that adapts to different screen sizes, ensuring optimal user experience across desktop, tablet, and mobile devices. The header typically includes a logo and navigation menu that reorganizes itself based on the viewport width. Syntax /* Basic responsive header structure */ nav { overflow: hidden; background-color: color; } @media screen and (max-width: width) { /* Responsive styles */ } Set the nav for logo and menus The element is used to place the logo ...
Read MoreC program to write all digits into words using for loop
In C programming, converting digits to their word equivalents is a common task that helps beginners understand conditional statements and loops. This program takes a range of digits and prints each digit as its corresponding word using a for loop. Syntax for(initialization; condition; increment) { // Convert digit to word using if-else statements } Example: Converting Digits to Words in a Range This example demonstrates how to convert all digits from 3 to 8 into their word representations using a for loop − #include void digitToWord(int ...
Read MoreHow to create a pill navigation menu with CSS?
A pill navigation menu features rounded, button-like navigation links that resemble pills. This design provides an intuitive and modern user interface for website navigation. The pill shape is achieved using CSS border-radius property to create rounded corners. Syntax nav { /* Container styles */ } nav a { border-radius: value; /* Other pill styling */ } Example: Creating a Pill Navigation Menu The following example demonstrates how to create a complete pill navigation menu with hover effects and active states − ...
Read MoreC program to convert digit to words
In C programming, converting a digit to its corresponding word representation is a common task. This involves taking a single digit (0-9) and converting it to its English word equivalent like "Zero", "One", "Two", etc. Syntax void digitToWord(int digit); Method 1: Using If-Else Statements This approach uses a series of if-else statements to check each digit and print the corresponding word − #include void digitToWord(int d) { if (d < 0 || d > 9) { printf("Beyond range ...
Read MoreHow to create a fixed social media icon bar with CSS?
A fixed social media icon bar allows users to access your social media profiles from anywhere on the page. The bar remains visible even when scrolling, making it convenient for visitors to connect with you on different platforms. Syntax .social-bar { position: fixed; top: value; left/right: value; } Example The following example creates a fixed social media icon bar that stays positioned on the left side of the page − * { ...
Read MoreC program to find sum and difference using pointers in function
In C programming, functions can return only one value at a time. However, when we need to calculate multiple results like sum and difference of two numbers, we can use pointers as function parameters. This technique allows us to modify the original variables directly through their memory addresses. Syntax void functionName(int *ptr1, int *ptr2); // Call the function functionName(&variable1, &variable2); Algorithm To solve this problem, we will follow these steps − Define a function that takes addresses of two variables as parameters Store the sum in a temporary variable Calculate the difference ...
Read MoreC program to find maximum of four integers by defining function
In C programming, we can find the maximum of four integers by defining our own function. We create a max() function that compares two numbers and returns the larger one, then use it repeatedly to find the maximum among all four numbers. So, if the input is like a = 5, b = 8, c = 2, d = 3, then the output will be 8. Syntax int max(int x, int y); Algorithm To solve this, we will follow these steps − Define a function max() that takes two integers x ...
Read MoreHow to create a \"button group\" with CSS?
A button group is a set of buttons styled to appear connected as a single unit. This creates a cohesive interface element where related actions are grouped together. Button groups are commonly used for navigation, social media links, or filter options. Syntax .button-group { display: inline-block; } .button-group button { float: left; border: none; padding: value; } .button-group button:hover { background-color: value; } Example: Basic Button Group The following example creates a ...
Read MoreC program to find sum and difference of two numbers
In C programming, finding the sum and difference of two numbers is a fundamental operation. This program demonstrates how to perform arithmetic operations on different data types and handle the output formatting correctly based on the operands' types. Syntax // For integer arithmetic int result = num1 + num2; int result = num1 - num2; // For floating-point arithmetic float result = num1 + num2; float result = num1 - num2; Example 1: Sum and Difference of Integer Numbers This example shows basic arithmetic operations on integer values − ...
Read More