Answer:
1 <?php
2 if (isset($_GET["submit"])) {
3 echo "Welcome " . $_GET["name"];
4 }
5 ?>
6
7
8 <form method="get">
9 <input name="name" type="text" placeholder="Enter your name"/>
10 <button name="submit" type="submit">Submit</button>
11 </form>
12
13 <?php
14 ?>
<h2>
Explanation:</h2>
Lines 1 - 5 check if the user has clicked on the submit button.
If the button has been clicked the a welcome message is
shown.
Lines 8 - 11 create a form to hold the text box and the submit button
Give the form a <em>method</em> attribute of value <em>get [Line 8]</em>
<em> </em>Give the input field a <em>name</em> attribute of value <em>name </em>and a
placeholder attribute of value <em>Enter your name [Line 9]</em>
<em> </em>Give the button a <em>name </em>attribute of value <em>submit</em> and a <em>type</em>
attribute of value <em>submit</em> <em>[Line 10]</em>
<em />
<em />
<em />
<em />
PS: Save the file as a .php file and run it on your server. Be sure to remove the line numbers before saving. A sample web page is attached to this response.
Answer:
// Assume that all variables a, n, temp have been declared.
// Where a is the array, n is the array length, temp is a temporary
// storage location.
// Cycle through the array a.
// By the time the loop gets halfway,
// The array would have been reversed.
// The loop needs not get to the end of the array.
// Hence, the loop ends halfway into the array i.e n/2.
for (int k = 0; k < n / 2; k++) {
// Swap first and last, second and next-to-the-last and so on
temp = a[k];
a[k] = a[n - k - 1];
a[n - k - 1] = temp;
}
Explanation:
Explanation has been given in the code in form of comments. Please go through the comments in the code carefully.
Hope this helps!
Answer:
yes
Explanation:
the faster the processor the better the computer loads things and works faster, there's little to no latency depending on the wifi