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
oksian1 [2.3K]
3 years ago
12

Write a complete program to read two integers and display the number of integers that lie between them, including the integers t

hemselves. for example, four integers are between 3 and 6: 3, 4, 5, and 6.
Computers and Technology
1 answer:
Lyrx [107]3 years ago
6 0
#python:
min=input ("Gimmie an integer: ")
max=input ("Gimmie another integer: ")

for c in range(int(min), int(max) + 1):
    print (c, "", end="")
#in: 1 3
#out: 1 2 3
#I don't know pascal
// java
import java.util.Scanner;
class Program {
    public static void main ( String args[]) {
        Scanner input = new Scanner (System.in);
        int min = input.nextInt();
        int max = input.nextInt();
        
        for ( min, min <= max; min++) {
            System.out.print(min + " ");
        }
}// c++:
import <iostream>
int main() {
    for ( min, min <= max; min++) {
            cout<<min<<" "

        }
    return 0;
}
// ... I got bored
You might be interested in
What is an example of a transition effectl
yawa3891 [41]
Well try finding out what transition effect means 
8 0
3 years ago
The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per se
german

Answer:

The Java Program for the given problem is as below. Directly copy the code and run it on your machine.

Explanation:

Refer the Screenshots attached for the output.

import java.io.BufferedReader;

import java.io.InputStreamReader;

public class TheSpeedOfSound {

public static void main(String[] s)

{

String medium;

double distance;

double time;

try{

BufferedReader choice = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter one of the following: air, water, or steel: ");

medium = choice.readLine(); // reading input i.e. air, water or steel

//check for air water and steel

if (medium.equalsIgnoreCase("air") || medium.equalsIgnoreCase("water") || medium.equalsIgnoreCase("steel")){

System.out.println("Enter the distance the sound wave will travel: ");

distance = Double.parseDouble(choice.readLine()); // read distance value if it is air water or steel

switch (medium)

{

//if medium is air

case "air":

time = distance/1100;

System.out.print("It will take " + time + " seconds.");

break;

//if medium is water

case "water":

time = distance/4900;

System.out.print("It will take " + time + " seconds.");

break;

//if medium is steel

case "steel":

time = distance/16400;

System.out.print("It will take " + time + " seconds.");

break;

}

}

else{

System.out.print("Sorry, you must enter air, water, or steel.");  

}

}

catch(Exception e){

e.printStackTrace();

}

}

}

8 0
3 years ago
Complete the AscendingAndDescending application so that it asks a user to enter three integers. Display them in ascending and de
Andreas93 [3]

Answer:

Following are the solution to the given question:

import java.util.Scanner;//import package

public class AscendingAndDescending//defining a class AscendingAndDescending  

{

   public static void main(String[] args) //main method

   {

       int n1,n2,n3,min,max,m;

       Scanner in = new Scanner(System.in);//creating Scanner class object

       System.out.print("Enter an integer: ");//print message

       n1 = in.nextInt();//input value

       System.out.print("And another: ");//print message

       n2 = in.nextInt();//input value

       System.out.print("And just one more: ");//print message

       n3 = in.nextInt();//input value

       min = n1; //use min variable that holds value

       max = n1; //use mix variable that holds value

       if (n2 > max) max = n2;//use if to compare value and hols value in max variable

       if (n3 > max) max = n3;//use if to compare value and hols value in max variable

       if (n2 < min) min = n2;//use if to compare value and hols value in min variable

       if (n3 < min) min = n3;//use if to compare value and hols value in min variable

       m = (n1 + n2 + n3) - (min + max);//defining m variable that arrange value

       System.out.println("Ascending: " + min + " " + m + " " + max);//print Ascending order value

       System.out.println("Descending: " + max + " " + m + " " + min);//print Descending order value

   }

}

Output:

Enter an integer: 8

And another: 9

And just one more: 7

Ascending: 7 8 9

Descending: 9 8 7

Explanation:

In this program inside the main method three integer variable "n1,n2, and n3" is declared that inputs value from the user end and also defines three variable "min, max, and m" that uses the conditional statement that checks inputs value and assigns value according to the ascending and descending order and prints its values.

5 0
3 years ago
If you want to open an application that does not have a tile pinned to the start menu
guapka [62]
Search for it in the start menu. Once you find it, right click and press "Pin to taskbar."
6 0
3 years ago
Which one of the following items would you be most likely to keep in a database? A. Payroll records B. Address book C. Financial
True [87]
The item that you would most likely to keep in a database is a Payroll record. Payroll records are numbers and inputs/outputs of employees of a certain company. Numbers are easier to manipulate and easier to manage than statements, letters and addresses that are basically letters.
3 0
3 years ago
Other questions:
  • Write a main method that prompts the user for an integer between 1 &amp; 10 (inclusive). If the user enters an invalid number, p
    10·1 answer
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·2 answers
  • Web pages often have built-in connections, or links, to other documents, graphics, other web pages, or web sites. true or false?
    9·1 answer
  • True or False?
    8·1 answer
  • What does my name look like in binary code, btw my mane is Wendy Alexis Morales
    10·2 answers
  • Your sister asks you if it is possible to get an office productivity suite for free. What do you tell her?
    13·1 answer
  • How does recorded audio stay on an audio tape
    12·1 answer
  • The image below shows an encoding for a black and white pixel image. The first two
    13·1 answer
  • Differences between dot_mattix printer and a line printer
    12·1 answer
  • What are the minimum number of bits an address bus must have in a byte addressable memory system containing only 4 KiB of memory
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!