What is h(41)-h(40), given the definition of h below?
def h(n):
s = 0
for i in range(1,n+1):
if n%i > 0:
s = s+1
return(s)Write a program that reads in a number and prints out the letter L using '*' characters
with each line in the L having width n. Further, the length of the horizontal bar should be
4n, and that of the vertical bar (i.e. not including the portion overlapping with the
horizontal bar) should be 3n. Thus for n=3 your program should print
***
***
***
***
***
***
***
***
***
************
************
************
4.1.1 Students in Computer Science would like to understand the concept of Ohm’s law. You
are required to write an application that will allow them to calculate the relation
between Voltage, Current and Resistance using the formulas below.
V = IR
Current (I) = V/R
Resistance= V/I
(where I is the current, V - Voltage and R is the resistance)
4.1.1 Write a program that will assist the students:
4.1.2 Create a C++ source file called OLaw and save it in a file called OLaw.cpp.
4.2 Create the following functions:
4.2.1 calcVoltage() This function must calculate the voltage in a circuit using the
information given above.
4.2.2 calcCurrent() This function must calculate the current charge using the information
given above.
4.2.3 calcResistance() This function must calculate the resistance of the flow using the
information given above.
4.2.4 main() NB: The functions must be implemented above the main.
Add all necessary pre-processor directives.
Declare all constants and necessary variables.
Prompt the user for the calculation h
Fill in the blanks in the following program so that it draws the given picture. Each
figure is a rhombus with side 100 and interior angles (60, 120, 60, 120). The distance
between 2 adjacent rhombuses is 20 (between their closest vertices).
Fill in the blanks in the following program so that it draws the given picture. Each
figure is a rhombus with side 100 and interior angles (60, 120, 60, 120). The distance
between 2 adjacent rhombuses is 20 (between their closest vertices).
repeat(2){
repeat(2){
B1;
left(B3);
B1;
left(120);
}
right(120);
penUp();
B2;
penDown();
repeat(2){
B1;
left(120);
B1;
left(B3);
}
right(B3);
penUp();
B2;
penDown();
}
What is command B1?
forward(100)
forward(20)
backward(100)
backward(20)
What is command B2?
forward(100)
forward(20)
backward(100)
backward(20)
What is B3?
What is h(41)-h(40), given the definition of h below?
def h(n):
s = 0
for i in range(1,n+1):
if n%i > 0:
s = s+1
return(s)What is h(41)-h(40), given the definition of h below?
def h(n):
s = 0
for i in range(1,n+1):
if n%i > 0:
s = s+1
return(s)Task 1 (2 pt): A program that converts a temperature in F that the user provides and returns the equivalent temperature in C. Hint: Google is your friend! Given F, solve for C. This program does not require an if structure and has a straight forward input – process – output structure!
Write a program which multiplies an N digit number M by a 1 digit number d, where N could be large, e.g. 1000. The input will be given as follows. First, the user gives d, then N and then the digits of M, starting from the least significant to the most significant. The program must print out the digits of the product one at a time, from the least significant to the most significant.
Hint: Mimic the process of manual multiplication. Keep track of the current carry in a variable and update it as you go along.
Write a program which multiplies an N digit number M by a 1 digit number d, where N could be large, e.g. 1000. The input will be given as follows. First, the user gives d, then N and then the digits of M, starting from the least significant to the most significant. The program must print out the digits of the product one at a time, from the least significant to the most significant.
Hint: Mimic the process of manual multiplication. Keep track of the current carry in a variable and update it as you go along.