Java Questons
Java Questons
Write a program to determine the keyboard input number is even or odd using the if else
statement.
2. Write the program to display the positive, negative or zero from given number using
keyboard.
3. Write a program to display descending sorted order by input three number accepted from
the keyboard.
4. Write a program that uses a SWITCH statement that print Male if a variable gender is
‘m’, print Female if gender is ‘f’ and prints Wrong Character response otherwise.
char gender=’M’;
5. Write a program that uses a if else statement to set ticket to 1 if speed is greater than 55
and to 0 otherwise.
6. Suppose you deposit $100 per month in bank account every month for a year . Every
month, after the deposit has been made, interest at the rate of 2% is added to the balance.
Write a program to calculate the balance for one year.
7. Write a program to find and output the prime number, the accept number from the
keyboard.
8. Write a java program to determine vowel or not following given character. Using switch
statement.
char ch=’a’; // ch = a or e or i A E I O U
9. Write a java program to calculate the sum and output between 1to 100.
(Using for loop)
10. Review a java program following program if user input number is 159 .
import java.util.Scanner;
class VariableSum {
public static void main(String[] Strings) {
Scanner input = new Scanner(System.in);
System.out.print("Input an integer between 0 and 1000: ");
int num = input.nextInt();
}
}
===============================================================================