The HTML DOM MouseEvent pageY property returns the vertical (y) coordinate of the mouse pointer relative to the document if a mouse event was triggered. Use with pageX to get the horizontal coordinate as well.Following is the syntax −Returning reference to the pageY objectMouseEventObject.pageYLet us see an example of MouseEvent pageY property −Example Live Demo MouseEvent pageY * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { width:70%; ... Read More
The HTML DOM MouseEvent pageX property returns the horizontal (x) coordinate of the mouse pointer relative to the document if a mouse event was triggered. Use with pageY to get the vertical coordinate as well.Following is the syntax −Returning reference to the pageX objectMouseEventObject.pageXLet us see an example of MouseEvent pageX property −Example Live Demo MouseEvent pageX * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { width:70%; ... Read More
The HTML DOM MouseEvent offsetY property returns the vertical (y) coordinate of the mouse pointer relative to the target element if a mouse event was triggered. Use with offsetX to get the horizontal coordinate as well.Following is the syntax −Returning reference to the offsetY objectMouseEventObject.offsetYLet us see an example of MouseEvent offsetY property −Example Live Demo MouseEvent offsetY * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { ... Read More
Suppose we have one 3x3 matrix, whose diagonal elements are empty at first. We have to fill the diagonal such that the sum of row, column and the diagonal will be same. Suppose a matrix is like −036505470After filling, it will be −636555474Suppose the diagonal elements are x, y, z. The values will be −x = (M[2, 3] + M[3, 2])/ 2z = (M[1, 2] + M[2, 1])/ 2y = (x + z)/2Example Live Demo#include using namespace std; void displayMatrix(int matrix[3][3]) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) cout
The HTML DOM MouseEvent clientY property returns the vertical (y) coordinate of the mouse pointer if a mouse event was triggered. Use with clientX to get the horizontal coordinate as well.Following is the syntax −Returning reference to the clientY objectMouseEventObject.clientYLet us see an example of MouseEvent clientY property:Example Live Demo MouseEvent clientY * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { width:70%; margin: 0 ... Read More
The HTML DOM MouseEvent clientX property returns the horizontal (x) coordinate of the mouse pointer if a mouse event was triggered. Use with clientY to get the vertical coordinate as well.Following is the syntax −Returning reference to the clientX objectMouseEventObject.clientXLet us see an example of MouseEvent clientX property −Example Live Demo MouseEvent clientX * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } #outer { width:70%; margin: 0 ... Read More
The HTML DOM Meter optimum property returns/sets a number corresponding to the optimum attribute of a element. Use this with high, low, min and max attributes for better results.NOTE: Don’t use as a progress bar but only as a gauge.Following is the syntax:Returning value of the optimum propertymeterElementObject.optimumValue of the optimum property setmeterElementObject.optimum = numberLet us see an example of Meter optimum property −Example Live Demo Meter optimum form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; ... Read More
In this problem to find the sum of sum of first n natural numbers, we will find the sum of all numbers from 1 to n and add them together to find the sum.Let’s take an example to learn about the concept,Input : 4 Output : 10 Explanation : Sum of first 1 natural number = 1 Sum of first 2 natural number = 1 + 2 = 3 Sum of first 3 natural number = 1 + 2 +3 = 6 Sum of first 4 natural number = 1 + 2 + 3 + 4 = 10 Sum of sum of 4 natural number = 1 + 3 + 6 + 10 = 20Example Live Demo#include using namespace std; int sumofSum(int n){ int sum = 0; for (int i=1; i
The HTML DOM Meter Object in HTML represents the element.NOTE: Don’t use as a progress bar but only as a gauge.Following is the syntax −Creating a elementvar meterObject = document.createElement(“METER”)Here, “meterObject” can have the following properties −PropertyDescriptionhighIt sets/returns the value ofthe high attribute in a gaugelabelsIt returns a list of elements that are labels for the gaugelowIt sets/returns the value ofthe low attribute in a gaugemaxIt sets/returns the value ofthe max attribute in a gaugeminIt sets/returns the value ofthe min attribute in a gaugeoptimumIt sets/returns the value ofthe optimum attribute in a gaugevalueIt sets/returns the value ofthe ... Read More
A BST or binary search tree is a form of binary tree that has all left nodes smaller and all right nodes greater than the root value. For this problem, we will take a binary tree and add all the values greater than the current node to it. the problem “ add all greater values to every node in BST” is simplified as for a BST add all the node values that are greater than the current node value to that node value.Add all greater values to each node in BST Problem Statement −Given a Binary Search Tree (BST), we ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP