Quick Links to Application questions (with solutions)!

C++.

Java.

Wednesday, February 17, 2010

Numbers - If statement + Conditional operators (with user input) code

import java.util.Scanner;
class bananas
{
public static void main(String args[])
{
Scanner eggs = new Scanner(System.in);
System.out.println("Enter an integer between 10 and 100: ");
int x;
x = eggs.nextInt();
System.out.println(10 < x && 100 > x ? "It's between 10 and 100." : "It's not between 10 and 100." );
}
}

No comments:

Post a Comment