3-Digit Osiris Number C Program

Arnab Chakraborty
Updated on 19-Aug-2019 14:07:54

181 Views

Here we will see the Osiris number. An Osiris number is such kind of number that are equal to the sum of permutations of sub-samples of their own digits. Suppose the number is 132. Then if we calculate {12 + 21 + 13 + 31 + 23 + 32} this is also 132. So the number is Osiris number. We have to check whether the given number is Osiris number or not.Approach is simple. If we analyze the numbers, each digit is occurring twice so they are in ones position and tens position. So we can check by multiplying 11 ... Read More

Push vs Unshift in JavaScript

vineeth.mariserla
Updated on 19-Aug-2019 13:58:49

329 Views

push() vs unshift()The methods push() and unshift() are used to add an element in an array. But they have a slight variation. The method push() is used to add an element at the end of the array, whereas the method unshift() is used to add the element at the start of the array. Let's discuss them in detail.push()syntaxarray.push("element");ExampleIn the following example, to a 3 element array, using push() method another element is added at the back of the array and the result is displayed in the output. var companies = ["Spacex", "Hyperloop", "Solarcity"]; ... Read More

Find Reminder of Array Multiplication Divided by N in C++

sudhir sharma
Updated on 19-Aug-2019 12:58:56

192 Views

Array multiplication we will find the product of all elements of the given array. and then according to the problem, we will divide the product with the number n. let's take an example −Input: arr[] = { 12, 35, 69, 74, 165, 54};       N = 47 Output: 14ExplanationThe array is like {12, 35, 69, 74, 165, 54} so the multiplication will be (12 * 35 * 69 * 74 * 165 * 54) = 19107673200. Now if we want to get the remainder after dividing this by 47 it will be 14.First multiple all the number then ... Read More

Armstrong Numbers Between Two Integers

sudhir sharma
Updated on 19-Aug-2019 12:57:02

1K+ Views

An integer is called an Armstrong number of order n if it's every digit separate out and cubed and summed up then the sum will be same as the number i.e. abcd... = a3 + b3 + c3 + d3 + ...In case of an Armstrong number of 3 digits, the sum of cubes of each digit is equal to the number itself. For example:153 = 13 + 53 + 33 // 153 is an Armstrong number.Input: Enter two numbers(intervals):999 9999 Output: Armstrong numbers between 999 and 9999 are: 1634 8208 9474Explanation1634 = 13+63+33+43 = 1+216+27+64 = 1634The approach implemented ... Read More

C++ Program for Bogosort (Permutation Sort)

sudhir sharma
Updated on 19-Aug-2019 12:51:50

856 Views

Bogosort simply shuffles a collection randomly until it is sorted. BogoSort is an ineffective algorithm based permutation and combination that's why it is known Permutation sort. BogoSort is very flop sorting technique which is also known as, shotgun sort, stupid sort, monkey sort, or slow sort. The algorithm successively generates permutations of its input until it finds one that is sorted.Input - 53421 Output - 12345ExplanationIn bogosort array will be consist of unsorted element checking if the array elements are in order, and if it is not, then change the position of array elements, by swapping the elements randomly, and ... Read More

C++ Program for the Cocktail Sort

sudhir sharma
Updated on 19-Aug-2019 12:47:46

320 Views

Cocktail sort is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort also known as bidirectional bubble sort, cocktail shaker sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort, or shuttle sort. The algorithm differs from a bubble sort in that it sorts in both directions on each pass through the list.Input:53421 Output:12345Explanation In Cocktail, sort array will be consist of the unsorted element. Cocktail sort works in both directions on each pass through the list. It sort array using bubble sorts once forwards and backward.Example#include ... Read More

HTML DOM Small Object

AmitDiwan
Updated on 19-Aug-2019 12:45:56

166 Views

The HTML DOM small object is associated with HTML element. We can create and access small element using the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a small object −var s= document.createElement("SMALL");ExampleLet us look at an example for the small object − Small object example Create a small element containing some text by clicking the below button CREATE This is normal text    function CreateSmall() {       var s = document.createElement("SMALL");       var txt = document.createTextNode("This is small text");       s.appendChild(txt);       document.body.appendChild(s);    } ... Read More

HTML DOM Input Text ReadOnly Property

AmitDiwan
Updated on 19-Aug-2019 12:36:03

495 Views

The HTML DOM Input Text readOnly property is used for setting or returning if the input text field is read-only or not. The readOnly property makes the element non-editable but it can still be focused by tab or click. If there is a default value inside a read-only element then it is sent to a server on submit.SyntaxFollowing is the syntax for −Setting the readOnly property −textObject.readOnly = true|falseHere, truly represents the text field is read-only while false represents otherwise. The readOnly property is set to false by default.ExampleLet us look at an example for the Input Text readOnly property ... Read More

Add 1 to a Number Represented as a Linked List

sudhir sharma
Updated on 19-Aug-2019 12:34:52

638 Views

The linked list representation of a number is provided in such a way that the all nodes of the linked list are treated as one digit of the number. The node stores the number such that the first element of the linked list holds the most significant digit of the number, and the last element of the linked list holds the least significant bit of the number. For example, the number 202345 is represented in the linked list as (2->0->2->3->4->5).And to add one to this linked list represented number we have to check the value of the least significant bit ... Read More

HTML DOM Input Text Placeholder Property

AmitDiwan
Updated on 19-Aug-2019 12:33:45

358 Views

The HTML DOM Input Text placeholder property is used for setting or returning the placeholder attribute value of an input text field. The placeholder property is used for giving the web page users a hint about the input element by showing a text inside the input field before the user inputs anything. The placeholder text is greyed by default and isn’t submitted to the form unlike the value property.SyntaxFollowing is the syntax for −Setting the placeholder property −textObject.placeholder = textHere, text represents the placeholder text specifying the hint for the user about the text field.ExampleLet us look at an example ... Read More

Advertisements