Answer:
while True:
number = int(input("Enter a number: "))
product = number * 10
if product > 100:
break
print(str(product))
Explanation:
Create a while loop that iterates until a specific condition is created inside
Ask the user for the input
Multiply the input and put the result in product
Check if the product is greater than 100. If it is, stop the loop using break keyword
When the loop is done, print the product
Answer:
The answers to 1st question and part 2A is given. However, the 2B is not given complete and thus cannot be answered.
Explanation:
UNION is a keyword used in C Language to have a commonly shared memory that can be used by multiple elements. It is a data-type that allows different data types to use the same shared memory location.
Importance: If you want to minimize the use of memory by sharing it between different datatype variables, then use UNION. For Ex. Let's suppose I want to use 2 variables a and b of type char and int respectively. Now, suppose int takes memory space of 2 bytes and char takes 1 byte then the total amount of memory needed = 2 + 1 = 3 Bytes. But, we want to first make use of a, and once done, we want to declare variable b. We can limit the memory use by declaring a memory space of 2 bytes (max of a and b). First, we can use this space to store the int variable and when done with it, we can use it to store the char variable.
PART 2A
typedef struct{
int partNum;
char partName[25];
} partin;
#define Partin partin
Answer:
Radius = 14 cm = 0.00014 km
Circumference = 2πr = 2 × 22/7 × 14/100000 = 0.00088 km
As it went thousand times , distance covered = 0.00088 × 1000 = 0.88 km