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
galina1969 [7]
2 years ago
12

Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and s

topping when both output digits are identical. So for example if you start at 98 and count down, the minute you reach 88 both numbers that make up 88 are identical and so you should quit looping.
Ex: If the input is: 93

the output is: 93 92 91 90 89 88


Ex: If the input is: 77

the output is: 77


Ex: If the input is: 15

or any number not between 20 and 98 (inclusive), the output is:

Input must be 20-98


For coding simplicity, follow each output number by a space, even the last one.


Use a while loop. Compare the digits; do not write a large if-else for all possible same-digit numbers (11, 22, 33, …, 88), as that approach would be cumbersome for larger ranges.


In C (not C++) please.


#include
< stdio.h >

int main(void) {


/* Type your code here. */


return 0;

}
Computers and Technology
1 answer:
barxatty [35]2 years ago
7 0

Answer:

<u>Image 1: Input</u>

integer x

x = Get next input

if x < 20 or x > 98

  Put "Input must be 20-98" to output

else

  while x/10 != x%10

     Put x to output

     Put " " to output

     x = x - 1

  Put x to output

  Put " " to output

<u>Image 2: Output</u>

Input:

93

Output:

93 92 91 90 89 88

You might be interested in
The pseudoinstructions that are available in an assembly language programming environment usually found in the Select one: a. CP
mafiozo [28]

Answer:

b

Explanation:

CPU manual provides guides to use a CPU.

Assembler manual provides guide on how to use an assembler and so is the case for compiler.

For a particular machine, it set of instructinos are available with the programmer.

6 0
3 years ago
When the narrator of "EPIC 2015" describes the year 2015 as the "worst of
denpristay [2]

Answer:

A. computers will be replaced by new technology

3 0
3 years ago
. Which game was the most popular free download in Apple®’s app store by January 2014, despite poor reviews and plagiarism accus
Brilliant_brown [7]
Flappy bird for the first question

7 0
3 years ago
Read 2 more answers
Write a Java program that can calculate and print out the area of a circle. The user enters data of the radius and its measureme
mezya [45]

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

  // Scanner object to read input

Scanner scr=new Scanner(System.in);

 // variables

double rad;

String unit1="in";

String unit2="ft";

String unit3="cm";

String unit4="m";

// ask user to enter radius

System.out.print("Enter the radius: ");

 // read radius

rad=scr.nextDouble();

 // check radius is negative or not

while(rad<0)

{

    System.out.println("Radius can't be negative:");

     // ask again to enter radius

    System.out.print("Enter the Radius again:");

     // read radius again

    rad=scr.nextInt();

}

// ask user to enter the unit of measurement

System.out.print("Enter the unit (\"in\" for inch, \"ft\" for feet, \"cm\" for centimeter, and \"m\" for meter):");

 // read unit

 String unt=scr.next();

 // calculate area

double area=3.14*rad*rad;

 // print area and unit

if(unt.equals(unit1))

    System.out.println(area+" inch.");

else if(unt.equals(unit2))

    System.out.println(area+" feet.");

else if(unt.equals(unit3))

    System.out.println(area+" centimeter.");

else if(unt.equals(unit4))

    System.out.println(area+" meter.");

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read radius of circle from user with Scanner object and assign it to variable "rad".Check the radius is negative or not.If the radius is negative ask user to enter radius again until user enters a positive radius.Then read the unit of measurement.calculate the area of circle and print area with unit.

Output:

Enter the radius: -4

Radius can't be negative:

Enter the Radius again:6

Enter the unit ("in" for inch, "ft" for feet, "cm" for centimeter, and "m" for meter):cm

Area of circle is 113.03999999999999 centimeter.

5 0
4 years ago
Write two lines of code to draw the following circles centered at 600,600. The radius of the smallest circle is 200. There are 5
Bad White [126]

Answer:

canvas.draw_circle((600, 600), 200, 3, "Black")

canvas.draw_circle((600, 600), 250, 3, "Black")

Explanation:

# include < conio.h>

# include < iostream.h>

int canvas.draw_circle,

namespace std

{

canvas.draw_circle((600, 600), 200, 3, "Black")

canvas.draw_circle((600, 600), 250, 3, "Black")

}

return,

7 0
4 years ago
Other questions:
  • ANSWER IN 5 MINUTES TO GET 50 POINTS!!!
    13·1 answer
  • A(n) ____ tag is used to let the compiler know that your intention is to override a method in a parent class
    10·1 answer
  • A system that monitors network use for potential hacking attempts and takes preventative action to block, isolate, or identify a
    11·1 answer
  • The help desk received a call from a user who cannot get any print jobs to print on the locally shared printer. While questionin
    10·2 answers
  • Consider a network of 8 routers connected together to provide more than one path of connectivity between host A and host B at tw
    8·1 answer
  • Write a program that reads a string of characters, pushing each character onto a stack as it is read and simultaneously adding i
    5·1 answer
  • What is a cloud in the world of computing
    7·1 answer
  • What is assembler? What is Compiler?What is interpreter?
    9·2 answers
  • What are the 3 dimension of an information system?
    13·1 answer
  • Integrity constraints are enforced by Group of answer choices A. The operating system B. The end user C. The database designer D
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!