What is Keith Number? A number is said to be a Keith number if it is arranged with a special sequence of numbers, which are initially created by its digits. The number sequence will be generated by adding its previous numbers till the number exceeds the input number. The results will be decided if the end number is exactly the same as the input number. For example, let's consider the number 14. The sequence will be as follows: s1 = 1, 4 s2 = 1, 4, 1 + 4 s3 = 1, 4, 5, 4 + 5 s4 = ... Read More
A dodecahedron is a three-dimensional shape that has twelve flat faces. It is derived from two Greek words, i.e., 'dodeka', which means 12, and 'hedra', which means face. In other words, a dodecahedron is a special type of polyhedron that has 12 faces. To make a dodecahedron, you can use the 12 pyramids and the base as a pentagon. Following diagram will provide a better understanding of its shape and edges: Where a is the length of the edge. Volume of Dodecahedron A dodecahedron volume refers to the amount of space occupied by this 3D shape, which has 12 faces. ... Read More
What is Goldbach Number? A number is said to be a Goldbach number if the number can be expressed as the addition of two odd prime number pairs. For example, let's consider the number 98 and find the pairs of prime numbers (19, 79). If you calculate the sum of 19 + 79, you get 98, so 98 is a Goldbach number. If we follow the above condition, then we can find that every even number larger than 4 is a Goldbach number because it must have any pair of odd prime number pairs. But the odd numbers are not satisfying because we know ... Read More
In Java, both double and float are data types that are used to declare a variable that can store only decimal values or floating point numbers. For example: 1.2343, 3.343, 24.321234, etc. The double data type is larger in size compared to the float data type. When to Prefer Double Type Over Float Type A double-type is preferred over a float-type if a more precise and accurate result is required. The precision of double-type is up to 15 to 16 decimal points, while the precision of float type is only around 6 to 7 decimal digits. Following are the syntaxes for ... Read More
A Triangular number of a natural number n, which is defined as the sum of all natural numbers starting from 1 to n. It is called triangular as we can represent it in the form of an equilateral triangular grid by using the total number of points where the row number equals the point number, which means in the 1st row 1 point, in the 2nd row 2 points, in the 3rd row 3 points, and so on. Examples of triangular numbers are 1, 3, 6, 10, 21, 55, etc. In simple terms, we can say a number is a ... Read More
What is Empire Number? A number is said to be an Empire number if it is a prime number, and when we reverse that number, we should get another prime number. For example, let's consider the number 17. We know that 17 is a prime number, and if we reverse this number, we get 71, which is also a prime number. Therefore, 17 is known as an empire number. Here are some other examples of prime numbers such as 11, 13, 17, etc. Input & Output Scenarios Below are a few input and output scenarios that help to understand the ... Read More
A Rectangle is a closed two-dimensional shape that has 4 sides and 4 corners. The opposite sides are of the same length and parallel to each other. All 4 interior angles are equal, angles measure 90 degrees. It is a four-sided polygon. Following is the diagram of the Rectangle: Checking Points Inside Rectangle A point is said to lie inside a rectangle if its x and y coordinates are between the x and y coordinates of the opposite corners of the rectangle. To determine whether the point lies within the rectangle, we will use the following approaches: ... Read More
In C++, we cannot return multiple values from a function directly. But, by using some methods (i.e., techniques), we can return multiple values from a function. How to Return Multiple Values from a Function? A function can return only one value using the return statement. We can return multiple values (more than one value) from a function by using the "call by address" and "call by reference" approach in the invoker function. Return Multiple Values from a Function Using Call by Address In C++, the call is an address, also known as a call by pointer. It passes ... Read More
Here we will see how to print leading zeros as output in C++. We know that if we directly put some zeros before some numeric values, then all zeros are discarded, and only exact numbers are printed.Printing Leading Zeros with C++ Output Operator We can manipulate the output sequence in C++ by utilizing the iomanip header. In this header, we have two manipulators, setw() and setfill(). The setw() function is used to create space between the previous text and the current text, and then we use setfill(char) to add characters to that field. Example of Printing Leading Zeros In this ... Read More
In this article, we will learn to use the readNBytes() method of InputStream in Java 9. We will get to know the InputStream Class with its methods as readNBytes() is a method of this class. After that, we will learn about the readNBytes() method with its syntax and when to use this method, along with an example. InputStream Class The Java InputStream class is the superclass of all classes representing an input stream of bytes. Every subclass of InputStream always needs to introduce a method to return the next byte on request. The following are some of the common methods of ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP