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 AYUSH MISHRA
Page 5 of 12
PHP Program to Print Multiplication Table
A multiplication table is a useful mathematical tool that displays the products of a given number with a range of values, typically from 1 to 10. In this article, we will learn multiple ways to generate and print multiplication tables in PHP. Formula to Generate Multiplication Table To create a multiplication table for any number, use the formula ? Answer = Number × Multiplier Where: Number is the fixed value for which the table is generated Multiplier is the range of values (e.g., 1 ...
Read MorePHP Program for Binary to Decimal Conversion
Binary to decimal conversion is the process of converting a binary number (base-2 number using only 0s and 1s) into its equivalent decimal number (base-10 form). In this article, we will learn how to convert binary numbers to decimal form in PHP using different approaches. How Binary to Decimal Conversion Works To convert a binary number to decimal, multiply each binary digit by 2 raised to the power of its position (starting from 0 on the right), then sum all results ? Binary to Decimal Conversion: 1011 Position: ...
Read MorePHP Program to Count Vowels in a String
A string is a sequence of characters, including alphabets, numbers, and symbols. In this tutorial, we are going to learn how we can count the number of vowels in a given string in PHP using different approaches. Vowels in English are a, e, i, o, u, and they can be either uppercase or lowercase. What is a Vowel? Vowels are alphabetic characters that represent specific speech sounds. There are a total of five vowels, both uppercase and lowercase in the English language: a, e, i, o, u A, E, I, O, U Example 1 ...
Read MoreHow to Check If Two Arrays are Equal in PHP?
When working with arrays in PHP, you often need to compare them to check if they contain the same elements. Array equality can mean different things − same elements in same order, same elements regardless of order, or strict type matching. This article explores different approaches to check if two arrays are equal in PHP. Using the == Operator The == operator provides a loose comparison, checking if arrays have the same elements in the same order without strict type checking ? The arrays are equal Using the === Operator ...
Read MorePHP program to find the perimeter of rectangle
A rectangle is a closed two-dimensional figure with 4 sides where opposite sides are equal and parallel. The perimeter is the total distance around the rectangle, calculated by adding all four sides. In this tutorial, we'll learn different PHP approaches to calculate rectangle perimeter. Length Breadth Length Breadth Formula The formula for calculating rectangle perimeter is − Perimeter = 2 × (Length + Breadth) Where length is the horizontal distance and breadth is the vertical distance. Direct Formula Approach The ...
Read MorePHP Program to Check if a Number is an Armstrong Number
An Armstrong number is a number in which the sum of its digits raised to the power of the number of digits is equal to the number itself. In this article, we will discuss how to check if a given number is an Armstrong number using PHP. Examples Let's understand Armstrong numbers with some examples ? Example 1: 9474 This is a four-digit number with digits 9, 4, 7, and 4. 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ = 6561 + 256 + 2401 + 256 ...
Read MoreHow to Add Elements to the End of an Array in PHP
Arrays are linear data structures used to handle data in programming. Sometimes while dealing with arrays we need to add new elements to an existing array. In this article, we will discuss several methods to add elements to the end of an array in PHP, complete with code examples and outputs. Following are different approaches to adding elements to an array − Using Square Brackets [] The simplest way to add an element to the end of an array in PHP is by using square brackets []. This syntax is suitable when you want to add only ...
Read MorePython Program to Print Hollow Rectangle pattern
When we start programming then printing different star patterns helps us build our logic and problem-solving skills. One of the easiest and beginner patterns is the hollow rectangle pattern. In this article, we are going to learn how we can print the hollow rectangle pattern using different approaches in Python. Hollow Rectangle Pattern A Hollow rectangle pattern is a rectangle-shaped pattern printing of stars where the stars are present only on the boundaries of the rectangle. The rectangle is hollow, i.e., the stars are printed only on the boundaries of the rectangle, while the inner area remains empty. ***** ...
Read MorePython Program to count nodes in a binary tree
In this article, we are going to learn how we can count the total number of nodes in a binary tree in Python, using different approaches. A binary tree is a data structure in which each node can have at most two children. The two children node of a binary tree are called the left child and the right child. We have to calculate the total number of nodes present in the binary tree. Scenario 1 Input: Binary Tree = 1 2 3 4 5 Output: Total number of nodes: 5 Above-given binary tree has five nodes: 1, 2, ...
Read MoreFind the number that appears once, and the other numbers twice in Java
In this problem, we are given an array of integers. In the given array, each element occurs two times except one element, which occurs only once. We have to find the number that appears only once. In this article, we are going to learn how we can find the number that appears once, and all other numbers appear twice in Java. Scenario 1 All other numbers except 4 occur twice, so 4 is the only number that appears only once. Input: [ 1, 2, 3, 3, 2, 4, 1, 5, 5] Output: 4 Scenario 2 All other numbers except ...
Read More