Here's a solution in node.js. Can be easily transcribed to other languages:
var paint_per_sqf = 1/350;
var wall_area = 250.0;
var gallons_paint = wall_area * paint_per_sqf;
console.log(wall_area.toFixed(1) + " square feet wall will need:");
console.log(gallons_paint.toFixed(12) + " gallons of paint");
Answer: 1 time.
Explanation:
- A binary function is also known as a half-interval search is a search algorithm to find the position of a given element x within a well-sorted array [].
- Binary search compares the target value to the middle element of the array.
- It ignores half of the elements just after one comparison.
- it compares x with the middle element.
So, the function read an element <u>one time</u> in the array before finding the value.
Answer: Change this however you'd like :)
Explanation:
for n in range(100):
print("priya")
print()
for n in range(10):
for i in range(10):
print("priya", end= " ")
print()
print()
tempList = []
for n in range(1, 1001):
tempList.append(n)
print(sum(tempList))
print()
for n in range(1, 9):
for i in range(1, 9):
print(n*i)
print()
x = 100
while x != 0:
print(x)
x -= 1