Results 1 to 2 of 2
Thread: What am I doing wrong here??
- 10-10-2012, 11:12 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 4
- Rep Power
- 0
What am I doing wrong here??
I have done this program, everything is working exempt the last if-statement, when i type in 0 as the first number, it continues to write in another number instead of just writing out Thank you.
import java.util.Scanner;
public class Uppgiftb {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Write any numberl");
int a = reader.nextInt();
System.out.println("Write another number");
int b = reader.nextInt();
if (a > b) {
System.out.println(a + " is bigger than " + b);
} if (a < b) {
System.out.println(b + " is bigger than " + a);
} if (a==b) {
System.out.println("The numbers are the same");
} if (a==0) {
System.out.println("Thank you.");
}
- 10-11-2012, 12:51 AM #2
Member
- Join Date
- Oct 2012
- Posts
- 31
- Rep Power
- 0
Similar Threads
-
Wrong output (well.. the one who's wrong is probably me ;) )
By shacht1 in forum New To JavaReplies: 4Last Post: 06-11-2013, 01:37 AM -
I can't find anything wrong with this but somehow it's wrong.
By Biscuit Tickler in forum New To JavaReplies: 2Last Post: 09-12-2012, 09:28 PM -
Anyone know what is wrong?
By BChow in forum New To JavaReplies: 5Last Post: 11-02-2011, 11:09 AM -
Something is Wrong O.o
By Spidermonkey in forum Advanced JavaReplies: 16Last Post: 11-14-2010, 04:33 AM -
What exactly am I doing wrong?
By SeanC in forum New To JavaReplies: 3Last Post: 09-27-2010, 03:37 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks