Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to another variable call z. Use z for adding 30 into it and print the final result by using variable results.

Answers

Answer 1
Answer:

Answer:

a = int(input("Enter first value between 1 - 10"))

b = int(input("Enter second value between 1 - 10"))

z = a + b

z += 30

print("The value of z = ", z)

Explanation:

The code is written above in python language to perform the given task.

Now, let us explain each statement of code.

Step 1: The first two lines take input from the user prompting the user to enter the values between 1 to 10.

Then the values are type casted to int using int().

The values are stored in variables a and b.

Step 2: Then, the values of a and b are added to get another variable z.

Step 3: The statement 'z += 30' is equivalent to z = z+30

It adds 30 to the variable z and stores it in the same variable z.

Step 4: Finally the value of variable 'z' is printed using print() command.


Related Questions

is the amount of variation between the lightest highlight and the darkest shadow in a particular image.
Consider the operation of a machine with the data path given below. Suppose that loading the ALU input registers takes 5 nsec, running the ALU takes 10 nsec, and storing the result back in the register scratchpad takes 5 nsec. What’s the maximum number of MIPS this machine is capable of with pipelining with the three execution stages?
What is Interface in computers
People convicted of cyberbullying in most statesface no punishment for their actions.face varying degrees of punishment.are taught how to use technology positively.are forced to do community service.
What is touch-typing?typing with a keyboard shortcut typing with macros typing with only one hand typing without looking at the keyboard

Whichof following can be thrown using the throw statement?ErrorThrowableExceptionRuntimeExceptionAll of Given

Answers

Answer: Exception

Explanation: A throw statement is a statement that whenever it gets executed ,it stops the flow of the execution immediately. The throw statement has a throw keyword for stopping of the execution which is denoted as the exception. A checked or unchecked exception can only be thrown. The compiler of a program has the function of giving warning if there are chances of exception.

1) The program reads an integer, that must be changed to read a floating point. 2) You will need to move that number into a floating point register and then that number must be copied into an integer register. 3) You will need to extract the exponent from the integer register and stored in another register. 4) You will need to insert the Implied b

Answers

Answer:

1. Get the number

2. Declare a variable to store the sum and set it to 0

3. Repeat the next two steps till the number is not 0

4. Get the rightmost digit of the number with help of remainder ‘%’ operator by dividing it with 10 and add it to sum.

5. Divide the number by 10 with help of ‘/’ operator

6. Print or return the sum

# include<iostream>

using namespace std;

/* Function to get sum of digits */

class gfg

{

   public:

   int getSum(float n)

   {

   float sum = 0 ;

   while (n != 0)

   {

    sum = sum + n % 10;

    n = n/10;

   }

return sum;

}

};

//driver code

int main()

{

gfg g;

float n = 687;  

cout<< g.getSum(n);

return 0;

}

Explanation:

Which of the following statements is not true?A. A structured chart is a sequential representation of program designB. the Real-Time system is a particular case of a on-line-systemC. Batch totals are not incorporated while designing real-time applicationsD. 4GLs are used for application proto typingE. None of the above

Answers

Answer:

A structured chart is a sequential representation of program design

Explanation:

It is true that a real-time system which is a term to describe an operating system working in relation to real-time is actually a form of the online system. Hence, option B is not correct.

It is also true that Batch totals are not incorporated while designing real-time applications because Batch Data processing is carried out in a separate manner and at a time when the computer is free. Thus Option C is not Correct

It is also true that 4GL which stands for Forth generation programming language is used for application prototyping. Again Option D is not Correct.

However, a structured chart is not a sequential representation of program design, but rather a break down to the infinitesimal module in the program design. Hence, option A is the correct answer.

Why are two-way communications necessary between the front desk and housekeeping?

Answers

With a PDA on two-way correspondence, a servant's work routine can be preloaded into their terminal before the start of their work move. As the work is finished, the data is transmitted to the front office frameworks. They can utilize the two-route correspondence to convey changes and prompt needs or crises with each other in a matter of moments.

PowerPoint provides a wide variety of predefined shapes that can add visual insert to a slide true or false

Answers

PowerPoint provides a wide variety of shapes for visual inserts this is true
True because you are able to add pictures and other visual representations

Which of the following statements is true of recombinant batteries? A. They recombine oxygen.
B. They're able to produce a higher voltage.
C. They're vented to release gassing.
D. They recombine sulfuric acid.

Answers

I’d go for (A) as the right choice.

The basic principles of Oxygen-recombination chemistry hasbeen combined to traditional lead batteries technology to produceValve-regulated lead-acid battery (VRLA), also called recombinant batteries. The applicationof oxygen cycle to VRLA, at first, is much more difficult. However, if correctprinciples are followed, it becomes easy.