19.3k views
4 votes
Write a complete program to read two integers and display the number of integers that lie between them, including the integers themselves. for example, four integers are between 3 and 6: 3, 4, 5, and 6.

User Max Elkin
by
8.8k points

1 Answer

7 votes
#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
User Ehud Grand
by
7.8k points