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
Articles by AYUSH MISHRA
Page 3 of 12
C++ Program to count the number of days in a given month of a year
There are a total of 365 days in a normal year and 366 days in a leap year. In this article, we are going to learn how we can find the number of days in a month of a given particular year. Here, we will learn about different approaches for calculating the number of days in a given month using C++. How to Find the Number of Days in a Given Month? There are a total of 12 months in a year. The number of days in a given month from 1 to 12 in a given leap or non-leap ...
Read MoreJavaScript program to find Number of Squares in an N*N grid
A grid is a 2-dimensional arrangement of squares divided into rows and columns. From a given N*N square grid we have to calculate the total number of squares possible. There are multiple ways to find the number of squares in a given grid. In this article, we are going to learn about various approaches for calculating the number of squares in a given grid of size N*N. Direct Formula for Finding the Number of Squares in an N*N Grid The direct formula for finding the total number of squares in an N * N grid is Total Number of ...
Read MorePHP Program to Find the Percentage of a Number
In this problem, we are given a number and a percentage value, and we have to find the percentage of the given number. In this article, we are going to learn how we can calculate the percentage of a number in PHP using different approaches. Example 1 The percentage of 300 with respect to 40% is calculated as (300 × 40) / 100 = 120. Input number=300; percentage = 40; Output 120 Example 2 The percentage of 300 with respect to 40% is calculated as (400 × 15) / 100 = 60. Input number=400; percentage = 15; Output 60 ...
Read MorePHP Program to Calculate Simple Interest and Compound Interest
What is Simple Interest and Compound Interest? Simple Interest is the interest that depends only on the principal amount taken while compound interest is compounded, i.e., previous interest is added in the current time period. In this article, we are going to learn how to calculate simple interest and compound interest using PHP, as this PHP tutorial is important for beginners. The formula for Calculating Simple Interest is: Simple Interest (SI) = P × R × T / 100 Where: P is the principal amount. R is the interest rate. ...
Read MoreSorting strings with decimal points in C++
A string containing decimal points is sorted to solve complex programming problems. This question was asked in the Accenture coding assessment in 2025. In C++, there are different ways to sort such strings efficiently. In this article, we are going to discuss various approaches to sorting strings that contain decimal points using C++. How to Sort Strings with Decimal Points? In this problem, we are given an array of strings, where each string represents a decimal number. The goal is to sort these strings in increasing numerical order while ensuring the correct handling of decimal values. Example 1 ...
Read MoreSorting an array of binary values - C++
Sorting an array of binary values (0s and 1s) is a common problem in programming. In C++, there are multiple ways to efficiently sort an array containing only 0s and 1s. In this article, we are going to learn various approaches to sorting an array of binary values using C++. How to Sort an Array of Binary Values? In this problem, we are given an array that consists of only 0s and 1s. The task is to sort the array in ascending order, which means all 0s should come before all 1s. Example 1 ...
Read MorePython Program for finding nth term of H.P.
A Harmonic Progression ( H.P.) is a sequence of numbers where the reciprocals of the terms form an Arithmetic Progression (A.P.). In simple terms, if we take the reciprocal of each term in an H.P., the resulting sequence will be in A.P. In this problem, we are given the first term, common difference, and value of n of which we have to find the nth term of given H.P. Find the nth term of H.P. To find the nth term of Harmonic Progression, we first convert the H.P. into an A.P. by finding reciprocals of the terms. The formula ...
Read MoreFind the number that appears once, and the other numbers twice in Python
Finding a unique number in a list that appears only once while all other numbers appear twice is a common and important problem in programming. We can find the unique number in a list using multiple ways. The most efficient approach is using an XOR operator, as this method solves this problem in constant time and space complexity. In this article, we are going to discuss various approaches to finding the number that appears once while all others appear twice. Finding the Unique Number When we are given a list of numbers where every number appears twice except one ...
Read MoreFirst and last position of an element in a sorted array in C++
The first and last position of any element in a sorted array is a common operation in the world of programming. In C++, there are multiple ways to find the first and last position of an element in a sorted array. In this article, we are going to discuss various approaches for finding the first and last occurrence of an element in a sorted array using C++. How to Find the First and Last Position of an Element? In this problem, we are given a sorted array and a target element. We need to find the first and last ...
Read MoreC# program to find first set bit
In this problem, we are given a number n, and we need to find the position of the first set bit (1-bit) in its binary representation. In this article, we are going to discuss different approaches to solving this problem using C#. Example 1 Input: N = 18 Output: 2 Explanation: The binary representation of 18 is 10010. The first set bit from the right is at position 2. Example 2 Input: N = 12 Output: 3 Explanation: The binary ...
Read More