# Recent posts tagged number

43 4 2 min.
Let us understand this program in the simplest way: Here, we will count a total number of words in a given string without using any built-in methods.We will Iterate over the String, once space is encountered,  increment the count value and print...
9 0 2 min.
Pseudo Random Number Generator (PRNG)Pseudo Random Number Generator(PRNG) refers to an algorithm that uses mathematical formulas to produce sequences of random numbers. PRNGs generate a sequence of numbers approximating the properties of random ...
0 0 1 min.
HOW TO COMPUTE THE NUMBER OF DAYS BETWEEN TWO DATES?First, we have to extract the integer values for the Year, Month and Day between two date strings. Then, we need a function e.g. f(d) to tell us the number of days since a fixed Date e.g. 1900-01-01...
0 0 2 min.
How to check if an input is a number in java public class StudyTonight { public static void main(String[] args) { String input = "1234"; try { Integer.parseInt(input); System.out.println(input + " is a valid int...
0 0 2 min.
How to check if a number is negative in java Read a number from the user using the Scanner class's method. check whether the given number is greater, lesser or, equal to 0. If it is greater given number is positive if the lesser given number...
0 0 2 min.
How to make a random number generator in c++The most fundamental problem of your test application is that you call srand once and then call rand one time and exit.The whole point of srand function is to initialize t...
0 0 2 min.
Swap two number without using third variable We can swap two numbers without using third variable. There are two common ways to swap two numbers without using third variable:By + and -By * and /#include<stdio.h> int main() { int...
0 0 3 min.
C program to print all combinations of a 4-digit numberThe main idea behind the solution to this problem is to find out the combination of 0,1 and 3. First of all, we will put the user-provided numbers in an array. Then using three&nbs...
0 0 2 min.
At first, we validate a phone number of 10 digits with no comma, no spaces, no punctuation and there will be no + sign in front the number. Simply the validation will remove all non-digits and permit only phone numbers with 10 digits. Here is the fun...
0 0 2 min.
How to check if array contains a number in javaIf your array is sorted, you can use the Arrays binarySearch() method to check if the array contains the given value or not.There are many ways to check if a Java array contains a specific value.Si...
0 0 1 min.
Let's write a java program to check whether the given number is armstrong number or not.Armstrong Number in Java: A positive number is called armstrong number if it is equal to the sum of cubes of its digits for example 0, 1, 153, 370, ...
0 0 1 min.
In this section, we will learn how to create a Java  program to find the largest of three numbers. Along with this, we will also learn to find the largest of three numbers in Java using the ternary operator. Using Ternar...
0 0 1 min.
Palindrome number in java: A palindrome number is a number that is same after reverse. For example 545, 151, 34543, 343, 171, 48984 are the palindrome numbers. It can also be a string like LOL, MADAM etc. Palindrome number algorithmGet the number to ...
0 0 1 min.
Prime number in Java: Prime number is a number that is greater than 1 and divided by 1 or itself only. In other words, prime numbers can't be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17.... are the prim...
0 0 1 min.
In Fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. The first two numbers of fibonacci series are 0 and 1.There are two ways to write the fibonacci series program in java:...
0 0 1 min.
This article discusses the method of generating random whole numbers of range 0 and 3. We’ll use a random() function but with a mathematical expression to generate the random number of range 0 and 3. The approach, program and output is given ah...
0 0 1 min.
This article will discuss and show how to split up a number of more than one digit to split into individual digits. Splitting numbers means writing all the digits of the number as an individual number. For example,  just assume we have the numbe...
0 0 2 min.
We add input in a web page to get input from the user, there are so many different input tags like text, number and many more. Assuming we want to get only numbers as input from the user, we can use number input but the user can still use characters ...
0 0 1 min.
The toFixed number in javascript is used for number formatting by using fixed-point notation. This can be used to format a number with a specific number of digits to the right side of the decimal.Syntax:numObj.toFixed([digits])Parameters:The number o...
0 0 1 min.
During the development of real-time applications, many times developers need to check whether the given input is a number or not. For Example, a mobile number, the user needs to check whether the number entered by a user contains only digits or not. ...