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
Grace [21]
3 years ago
6

Write a program that prompts the user to enter a four-digit integer and displays the number in reverse order. Here is a sample r

un:
Enter an integer: 5213

3

1

2

5
Computers and Technology
1 answer:
iVinArrow [24]3 years ago
7 0

Following are the code that is written in c language

#include <stdio.h>

int main() // main function

{

int n1,t; // declaring variable

printf(" Enter an integer :");

scanf("%d",&n1); // taking input

while(n1>0) // iterating over the loop untill the value of n is greater then 0

 {

t=n1%10;

printf("%d",t);

printf("\n");

n1=n1/10;

}

return 0;

}

Explanation:

we taking an integer value n1 and iterating over the loop untill n1>0

suppose n1=1234

then  t=n%10;

means t=1234%10

as % holds reminder means t=4

then print the value of t means print 4

and n1 becomes 123 which is > 0  again condition is checking and same process is follow untill n1>0

output

Enter an integer: 5213

3

1

2

5

You might be interested in
c++ 2.30 LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefi
Nady [450]

Answer:

#include <iostream>

using namespace std;

int main()

{

   //declare variable to store phone numbers,its area code, prefix and line number.

   long phone_number;

   int area_code, prefix,line_number;

   cout<<"Enter 10-digit phone number:"<<endl;

   //input 10-digit phone number

   cin>>phone_number;

   //logic to find area_code, prefix, and line_number.

   area_code = phone_number/10000000;

   prefix = (phone_number/10000)%1000;

   line_number = phone_number%10000;

   //output phone number in asked format.

   cout<<area_code<<"-"<<prefix<<"-"<<line_number<<endl;

   return 0;

}

Output:

Enter 10-digit phone number:

8005551212

800-555-1212

Explanation:

In the above program 10 digit phone number entered by user will be stored in the variable phone_number.

Then using this phone_number variable area_code, prefix, and line number are calculated using the following logic:

area_code = phone_number/10000000;

prefix = (phone_number/10000)%1000;

line_number = phone_number%10000;

Finally these area_code, prefix, and line_number are displayed with hyphen in between using cout statement.

5 0
3 years ago
Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the cou
Eduardwww [97]
In python:
total = 0
i = 0
while total <= 100:
number = int(input("Enter a number: "))
i += 1
total += number
print("Sum: {}".format(total))
print("Numbers Entered: {}".format(i))
3 0
3 years ago
2. Identify two real-world examples of problems whose solutions do not scale well.
DiKsa [7]

Answer:

The specification is defined downwards according to the conclusions reached.

Explanation:

Real-world instances or examples of issues that do not scale well are listed following table:

  • For different uses, such as solving the equation, respectively., multiplication matrices.
  • It still does not scales or works well to organize a wide sequence of names or numbers as the requisite measures raise as squares by around the enlargement or increment.
7 0
3 years ago
3.3 Code Practice: Question 1
NeX [460]

Answer:

Question1:

day = int(input("Enter in Numeric Today's day:"))

if (x == 15 or x == 30):

  print("You have a payday today!")

if (x != 15 and x != 30):

  print("Its is not certainly a payday today but dont feel bad.")

Question 2:

red = int(input("Enter the value for red: "))

green = int(input("Enter the value for green: "))

blue = int(input("Enter the value for blue: "))

if (red > 255 or red < 0):

  print("The value of Red is not correct.")

if (green > 255 or green < 0):

  print("The value of Green is not correct.")

if (blue > 255 or blue < 0):

  print("The value of Blue is not correct.")

Explanation:

Please check the answer section.

6 0
3 years ago
Write a program to input the radius of the base and height of a cylinder, and calculate and print the surface area, volume, and
Mama L [17]

Answer:

hello how are you my friend

Explanation:

8 0
3 years ago
Other questions:
  • Write a recursive function, len, that accepts a parameter that holds a string value, and returns the number of characters in the
    7·1 answer
  • Describe an application where a parallel circuit might work better than a series circuit.
    15·1 answer
  • A researcher wants to do a web-based survey of college students to collect information about their sexual behavior and drug use.
    15·1 answer
  • 1. Given a sequential list with n numbers, represented in a one-dimensional array A) Write an algorithm to check if the list has
    14·1 answer
  • Using the SUM function allows a series of numbers to be multiplied. subtracted. added. divided.
    13·1 answer
  • What will happen when you run this program?
    12·2 answers
  • Mention five of the format tools use to edit a picture in a word document<br>​
    13·1 answer
  • HELLLP PLEASEEEEEEEEE
    12·1 answer
  • Five varieties of software​
    13·1 answer
  • Select the correct answer.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!