C++ Program to Multiply Two Numbers

Samual Sam
Updated on 24-Jun-2020 07:58:02

3K+ Views

Multiplication of two numbers a and b yields their product. Value of a is added as many times as the value of b to get the product of a and b.For example.5 * 4 = 20 7 * 8 = 56 9 * 9 = 81Program to Multiply two Numbers using * OperatorA program to multiply two numbers using the * operator is given as follows −Example Live Demo#include using namespace std; int main() {    int a = 6, b = 8;    cout

Check Whether a Number is Palindrome in C++

karthikeya Boyini
Updated on 24-Jun-2020 07:57:21

3K+ Views

A palindrome number remains the same if its digits are reversed i.e its value does not change. A palindrome number can also be called symmetric. For example: The numbers 12321, 1551, 11 etc are palindromes as they do not change even if their digits are reversed.A program that checks if a number is palindrome or not is as follows.Example Live Demo#include using namespace std; void palindrome(int num) {    int rev=0,val;    val = num;    while(num > 0) {       rev = rev * 10 + num % 10;       num = num / 10;    }    if(val==rev)    cout

Create Command Menu Item from Popup Menu in HTML5

Ankith Reddy
Updated on 24-Jun-2020 07:54:05

321 Views

Use the tag to create a command/ menu item that the user can invoke from a popup menu in HTML5. The HTML tag is used for defining a menu item for a menu.The following are the attributes of the tag −AttributeValueDescription  checked  checked defines that a menuitem should be   checked default  default a menuitem is marked as a default   command disabled  disabled disables a menuitem and cannot be clicked icon  url defines an icon for a menuitem label  text defines a name for a menuitem which is displayed to the user radiogroup  groupname defines a group of commands out of which only one can be selectedtype ... Read More

Find All Roots of a Quadratic Equation in C++

karthikeya Boyini
Updated on 24-Jun-2020 07:47:19

9K+ Views

A quadratic equation is in the form ax2 + bx + c. The roots of the quadratic equation are given by the following formula −There are three cases −b2 < 4*a*c - The roots are not real i.e. they are complexb2 = 4*a*c - The roots are real and both roots are the same.b2 > 4*a*c - The roots are real and both roots are differentThe program to find the roots of a quadratic equation is given as follows.Example#include #include using namespace std; int main() {    int a = 1, b = 2, c = 1;    float discriminant, ... Read More

Include Direction of Text Display in HTML

Rishi Rathor
Updated on 24-Jun-2020 07:36:47

221 Views

Use the dir attribute in HTML, to add the direction of the text.ExampleYou can try to run the following code to include the direction of text display in HTML −           This is demo text from left-to-right.       This is demo text from right-to-left.    

Define Number of Columns in CSS Grid Layout

Rishi Rathor
Updated on 24-Jun-2020 07:34:15

1K+ Views

Use the grid-template-columns property to define the number of columns in CSS Grid Layout.You can try to run the following code to set a number of columns. Here, 3 column grid is set:ExampleLive Demo                    .container {             display: grid;             background-color: yellow;             grid-template-columns: auto auto auto;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: blue;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }                     Game Board                1          2          3          4          5          6          

Position Text to Top Right on an Image with CSS

Nancy Den
Updated on 24-Jun-2020 07:33:29

1K+ Views

To position text to top right, use the right and top property. You can try to run the following code to implement it:ExampleLive Demo                    .box {             position: relative;          }          img {             width: 100%;             height: auto;             opacity: 0.6;          }          .direction {             position: absolute;             top: 10px;             right: 19px;             font-size: 13px;          }                     Heading One       Below image has text in the top right:                          Top Right Corner          

C++ Program to Find GCD

Samual Sam
Updated on 24-Jun-2020 07:31:44

14K+ Views

The Greatest Common Divisor (GCD) of two numbers is the largest number that divides both of them.For example: Let’s say we have two numbers are 45 and 27.45 = 5 * 3 * 3 27 = 3 * 3 * 3So, the GCD of 45 and 27 is 9.A program to find the GCD of two numbers is given as follows.Example Live Demo#include using namespace std; int gcd(int a, int b) {    if (b == 0)    return a;    return gcd(b, a % b); } int main() {    int a = 105, b = 30;    cout

Test Java String for Case-Insensitive Regex Pattern

Arnab Chakraborty
Updated on 24-Jun-2020 07:29:15

423 Views

the syntax? i:x makes the string search case-insensitive. for egpublic class RegCaseSense {    public static void main(String[] args) {       String stringSearch = "HI we are at java class.";       // this won't work because the pattern is in upper-case       System.out.println("Try this 1: " + stringSearch.matches(".*CLASS.*"));         // the magic (?i:X) syntax makes this search case-insensitive, so it returns true       System.out.println("Try this 2: " + stringSearch.matches("(?i:.*CLASS.*)"));    } }

C++ Program to Swap Two Numbers

Samual Sam
Updated on 24-Jun-2020 07:26:57

3K+ Views

There are two ways to create a program to swap two numbers. One involves using a temp variable and the second way does not use a third variable. These are explained in detail as follows −Program to Swap Two Numbers using temp VariableThe program to swap two numbers using a temp variable is as follows.Example Live Demo#include using namespace std; int main() {    int a = 10, b = 5, temp;    temp = a;    a = b;    b = temp;    cout

Advertisements