Answer:
The program in Python is as follows:
n = int(input("Enter an integer: "))
if n < 0:
n = 0
print("Sequence:",end=" ")
for i in range(n,-1,-1):
if i%2 == 0:
print(i,end = " ")
Explanation:
This gets input for n
n = int(input("Enter an integer: "))
This sets n to 0 if n is negative
<em>if n < 0:</em>
<em> n = 0</em>
This prints the string "Sequence"
print("Sequence:",end=" ")
This iterates from n to 0
for i in range(n,-1,-1):
This check if current iteration value is even
if i%2 == 0:
If yes, the number is printed
print(i,end = " ")
Answer:
Explanation:
The diagrams attached to the questions are shown in the first and the second image below. The first image shows the code and the second image shows the error that appears at the moment of running it.
To answer that ; We will notice that the error in the second image is what it says; what happened is that the individual subject performing this action is trying to to open the file called "h.txt", but the python interpreter is unable to find the file. The individual subject will need to have h.txt inside your current working directory for python to open it.
From the third image attached ; I have careful attached an image that illustrate how you can add the file by going to file → open (right from your jupyter notebook). Afterwards you can either upload the file, or create a new text file and paste the contents on it as displayed in the fourth image attached in the diagram below.
Answer:
- #include <stdio.h>
- int main()
- {
- const double piVal = 3.14159;
- double sphereVolume = 0.0;
- double sphereRadius = 0.0;
-
- sphereRadius = 1.0;
- sphereVolume = 4.0/ 3.0 * piVal * sphereRadius * sphereRadius * sphereRadius;
-
-
- printf("Sphere volume: %lf\n", sphereVolume);
- return 0;
- }
Explanation:
Firstly we can identify the formula to calculate volume of sphere which is
Volume = 4/3
With this formula in mind, we can apply this formula to calculate the volume of sphere in Line 10. This is important to perform floating-point division 4.0/3.0 to ensure the resulting value is a floating value as well. Since we have been given piVal and sphereRadius, we can just multiply the result of floating-point division with piVal and sphereRadius and get the sphereVolume value.
At last, display the sphere volume using printf method (Line 13).
Statement two and three is correct.
Statement 1 is incorrect. A relative reference changes when a formula is copied to another cell while Absolute references remain constant. However, it is safe to say that an absolute address can be preceded by a $ sign before both the row and the column values. It is designated by the addition of a dollar sign either before the column reference, the row reference, or both. Statement C is also correct. A mixed reference is a combination of relative and absolute reference and the formula (= A1 + $B$2) is an example of a mixed cell reference.
Answer:
I don't know if this is right output is {1,3}
Explanation: