Objective reporting is reporting that separates facts and opinion.
Answer:
import sys
import turtle
import random
def n_pointed_star(total_points):
if total_points <= 4:
raise ValueError('Not enough total_points')
area = 150
for coprime in range(total_points//2, 1, -1):
if greatest_common_divisor(total_points, coprime) == 1:
start = turtle.position()
for _ in range(total_points):
turtle.forward(area)
turtle.left(360.0 / total_points * coprime)
turtle.setposition(start)
return
def greatest_common_divisor(a, b):
while b != 0:
a, b = b, a % b
return a
turtle.reset()
n_pointed_star(5)
Explanation:
- Inside the n_pointed_star function, check whether the total no. of points are less than or equal to 4 and then throw an exception.
- Loop through the total_points variable and check whether the result from greatest_common_divisor is equal to 1 or not and then set the starting position of turtle and move it.
- Create the greatest_common_divisor which takes two parameters a and b to find the GCD.
- Finally reset the turtle and call the n_pointed_star function.
This contains pretty much what you need:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>The Page Title</title>
</head>
<body>
<h1>First paragraph</h1>
<p>This is a paragraph of text.</p>
<h2>Second level paragraph</h2>
<p>
Here is an unordered list of options:
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
Here is another unordered list of options:
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
Here is an ordered list of options:
<ol>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
</p>
<h4>Third level</h4>
</body>
</html>
Answer:
#include <iostream>
using namespace std;
int main() {
int i = 2;
double j = 3;
int *p = &i;
double *q = &j;
cout << "p = " << p << ", p+1 = " << p+1 << endl;
cout << "q = " << q << ", q+1 = " << q+1 << endl;
return 0;
}
Explanation:
In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.
The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.
Answer:
Computer system use Binary and it uses power of 2 only.
Explanation:
The reasons for equipping memory with a peculiar number instead of round or even number are as follows:
- The computer system uses the power of 2 instead of the power of 10 to equipping memory and hence use a number like 250,000,000 is not possible.
- The computer systems work on the memory where 1 MB or 1 megabyte shows as 1024 kb or 1,048,576 bytes.
- In computer system memory capacity is always some multiply of 1024 bytes.
- Hence, 268,435,456 bytes of memory shows 256 MB of memory.