An enneagon also known as nonagon is a polygon with 9 sides. To calculate the area of enneagon the following formula is used, Area of ennagon = ((a2*9) / 4*tan (20°)) ∼= (6.18 * a2)Code Logic, The area of a polygon with nine sides is calculated by using the formula, ((a2*9) / 4*tan (20°)) ∼= (6.18 * a2). The value 6.18 is filled into a float variable called multiplier, this value then multiplied by the square of side of enneagon.Example Live Demo#include #include int main(){ int a = 6; float area; float multiplier = 6.18; ... Read More
The HTML DOM Input Date readOnly property sets/returns whether Input Date can be modified or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDateObject.readOnlySetting readOnly to booleanValueinputDateObject.readOnly = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that the input date is readOnly.falseIt defines that the input date is not readOnly and can be modified.ExampleLet us see an example of Input Date readOnly property − Live Demo Input Date readOnly Final Exam Date: Confirm Date var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); divDisplay.textContent = 'Exam Date Finalized: '+inputDate.readOnly; ... Read More
In the cstdlib library of C++, there are different functions for getting the absolute value except from abs. The abs are used basically for int type input in C, and int, long, long long in C++. The others are used for long, and long long type data etc. Let us see the usage of these functions.The abs() FunctionThis function is used for int type data. So this returns the absolute value of the given argument. The syntax is like below.int abs(int argument)Example#include #include #include using namespace std; main() { int x = -145; int y = 145; cout
Sometimes we may see some numeric literals, which is prefixed with 0. This indicates that the number is octal number. So octal literals contain 0 at the beginning. For example, if an octal number is 25, then we have to write 025.Example#include int main() { int a = 025; int b = 063; printf("Decimal of 25(Octal) is %d", a); printf("Decimal of 63(Octal) is %d", b); }OutputDecimal of 25(Octal) is 21 Decimal of 63(Octal) is 51
Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The isClosed() method of the ResultSet interface is used to determine whether the current ResultSet object is closed.rs.isclosed()Let us create a table with name tutorials_data in MySQL database using CREATE statement as shown below −CREATE TABLE tutorials_data ( tutorial_id INT, tutorial_title VARCHAR(100), tutorial_author VARCHAR(40), submission_date date, PRIMARY KEY (tutorial_id) );Now, we will insert 5 ... Read More
Let us first create a collection with documents −> db.embeddedDocumentDemo.insertOne( ... { ... "CustomerDetails":[ ... {"CustomerName":"Chris", "CustomerPurchasePrice":3000}, ... {"CustomerName":"Robert", "CustomerPurchasePrice":4500}, ... {"CustomerName":"David", "CustomerPurchasePrice":1000}, ... ] ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5cd32347edc6604c74817ccd") }Following is the query to display all documents from a collection with the help of find() method −> db.embeddedDocumentDemo.find().pretty();This will produce the following output −{ "_id" : ObjectId("5cd32347edc6604c74817ccd"), "CustomerDetails" : [ { "CustomerName" ... Read More
You can use $elemMatch operator for this. Let us first create a collection with documents −> db.pushNewItemsDemo.insertOne( { "_id" :1, "StudentScore" : 56, "StudentOtherDetails" : [ { "StudentName" : "John", "StudentFriendName" : [ "Bob", "Carol" ] }, { "StudentName" : ... Read More
The min attribute of the element is used to set the minimum value for . Both min and max are used to set a range of value for input element with type number, date, datetime, range, etc. It introduced in HTML5.Let us now see an example to implement the min attribute of the element. Here, we have set min as 1, therefore a user cannot enter an ID less than 1−Example Live Demo Log in to your account Id: Password: DOB: ... Read More
An octagon is a polygon with eight sides. To calculate the area of octagon the following formula is used, Area of octagon = ((a2*2) / *tan (22.5°)) = ((2*a*a)(1+√2))Code Logic, The area of a polygon with eight side is calculated by using the above formula. The expression uses sqrt function to find the square root of 2. The value of expression is evaluated as a floating point value that is put into the float area variable.Example Live Demo#include #include int main(){ int a = 7; float area; float multiplier = 6.18; printf("Program to find area ... Read More
The HTML DOM Input Date required property determines whether Input date is compulsory to set or not.SyntaxFollowing is the syntax −Returning boolean value - true/falseinputDateObject.requiredSetting required to booleanValueinputDateObject.required = booleanValueBoolean ValuesHere, “booleanValue” can be the following −booleanValueDetailstrueIt defines that it is compulsory to set the date field to submit form.falseIt is the default value and to set date field is not compulsory.ExampleLet us see an example of Input Date required property − Live Demo Input Date required Name: Date of Birth: Confirm var divDisplay = document.getElementById("divDisplay"); var inputDate = document.getElementById("dateSelect"); function submit() { ... Read More