1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Serggg [28]
3 years ago
9

(Reverse number) Write a program that prompts the user to enter a four-digit inte- ger and displays the number in reverse order.

Here is a sample run:
Computers and Technology
1 answer:
prohojiy [21]3 years ago
6 0

Answer:

The program in Python is as follows:

num = int(input("4 digit number: "))

numstr = str(num)

if(len(numstr)!=4):

    print("Number must be 4 digits")

else:

    numstr = numstr[::-1]

    num = int(numstr)

    print(num)

Explanation:

This prompts user for input

num = int(input("4 digit number: "))

This converts the input number to string

numstr = str(num)

This checks if number of digits is or not 4

if(len(numstr)!=4):

If not, the following message is printed

    print("Number must be 4 digits")

else:

If digits is 4,

This reverses the string

    numstr = numstr[::-1]

This converts the reversed string to integer

    num = int(numstr)

This prints the reversed number

    print(num)

You might be interested in
After running this Assembly language program below, give the final values in EAX, EBX, and ECX. MOV EAX, AAAAAAAA MOV EBX, BBBBB
Verdich [7]

Answer:

See explaination please.

Explanation:

We are going to get a solution by making use of the instruction;

Given The instruction,

MOV EAX, AAAAAAAA

MOV EBX, BBBBBBBB

MOV ECX, CCCCCCCC

This is going to move the defined values, say AAAAAAAA, BBBBBBBB, CCCCCCCC, to the registers EAX, EBX, ECX, respectively

Now,

PUSH AX

This push instruction pushes the first 8 bits in register EAX, to a stack,

again, PUSH BX

Also this push instructions will also push the first 8 bits in register EBX, to the stack

PUSH CX

This push instruction pushes the first 8 bits in register ECX, to the stack,

similarly PUSH BX PUSH AX PUSH CX pushes the 8 bit registers in the same stck,

NOw, the instructions POP EAX POP EBX POP ECX

will lead to the contents of the respective registers as

EAX=CCCCAAAA EBX=CCCCBBBB ECX=AAAACCCC

4 0
4 years ago
Read 2 more answers
The LCM of 4, 9, and 10 is _______.
Citrus2011 [14]
Answer: 180


Step by step explanation: brainlist??
5 0
3 years ago
Read 2 more answers
Multiple Intelligence Theory explains that...
Alex

Answer:

A. We all learn differently (edge 2020)

Explanation:

4 0
3 years ago
Read 2 more answers
2. Sanjay thinks it's okay to plagiarize because he thinks his instructors won't find out. However, it's
Tatiana [17]
The correct answer is B
8 0
3 years ago
Label provides the code that executes if no case label is matched ​
Ratling [72]

Answer:

In c/c++ it is <em>default</em>

7 0
3 years ago
Other questions:
  • How is a source file different from a "listing file"?
    5·1 answer
  • Misspelet errors are displays with a ...<br>.. below them<br>​
    10·1 answer
  • What describes a relationship between edge computing and cloud computing?
    6·1 answer
  • What is the process that creates a shortcut on your taskbar?
    14·2 answers
  • What kinds of objects might benefit from the use of the Loop Cut and Slide tool, and why? In your own words, how does edge loop
    14·1 answer
  • match the parts of a project plan listed in Column A to the specific examples given in Column B.Write the letter of your answer
    13·1 answer
  • What is meant by normalization? Occurs when an intrusion detection system labels normal activity as anomalous. The process of tr
    5·1 answer
  • Any computer expert to help me answer this question.. am giving brainliest
    13·1 answer
  • Characteristics of first generation computers​
    9·1 answer
  • Does every loop structure require curly braces?<br> A. yes<br> B. no
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!