For your homework today, write a program that inputs 3 integers. Then, output the 3 integers in the same order that they were input, but output all 3 of them on the same line. (Hint: you might want to use System.out.print.)
To see this working, head to your live site.
Search
kevinzhao183
Oct 4, 2020
Intro to Java 10/3/20 Homework
Intro to Java 10/3/20 Homework
5 comments
0
import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println("Please input 3 values."); Scanner x = new Scanner(System.in); int a = x.nextInt(); int b = x.nextInt(); int c = x.nextInt(); System.out.printf("%d %d %d",a, b, c);
import java.util.Scanner;
class Main {
public static void main(String[] args) {
System.out.println("please input 3 integers below.");
Scanner sc = new Scanner(System.in);
int one = sc.nextInt();
int two = sc.nextInt();
int three = sc.nextInt();
System.out.printf("%d%d%d",one,two,three);
}
}
import java.util.Scanner;
class Main {
public static void main(String[] args) {
System.out.println("please input 3 integers below.");
Scanner sc = new Scanner(System.in);
int one = sc.nextInt();
int two = sc.nextInt();
int three = sc.nextInt();
System.out.print(one, two, three);
}
}
import java.util.Scanner;
class Main {
public static void main(String[] args) {
System.out.println("put 3 integers");
Scanner sc = new Scanner(System.in);
int first = sc.nextInt();
int second = sc.nextInt();
int third = sc.nextInt();
System.out.println("first,second,third");
}
}
import java.util.Scanner; class Main { public static void main(String[] args) { System.out.println("please put in three numbers seperated by a space"); Scanner sc = new Scanner(System.in); int one = sc.nextInt(); int two = sc.nextInt(); int three = sc.nextInt(); System.out.printf("%d%d%d",three,two,one); } }