- 2
What is the mistake
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int firstBadGuy = read.nextInt(); int secondBadGuy = read.nextInt(); //your code goes here ; for(int i = 1; i <= 7; i++) { if(i == firstBadGuy && i == secondBadGuy ) { System.out.println("Bad guy"); } else { System.out.println("Good guy"); } } } }
4 odpowiedzi
+ 3
Is it the same task as here?
https://www.sololearn.com/Discuss/2930896/?ref=app
If so, you don't need to create a new thread – just post in the old thread :)
Also, people can help you much quicker, if you describe the task, tag the relevant programming language and put your code in a script!
+ 2
Idk what the code should do.
But with "&&" this code will only print "Bad guy" if both guys have the same number.
Maybe you want to print that for each bad guy. Then you have to use an "||" or.
+ 2
Please tag the language name relevant to your code and question (Java), rather than 'help' ☝
What was the task requirement?
+ 2
Achraf Soua
What is the name of the challenge.?
Can you give example inputs and output with a brief description of requirements