Java program to check character is vowel or consonant

Java program to check character is vowel or consonant  1. Java program to check character is vowel or consonant using if- else if statement: Program: import java.io.*; import java.util.*; class Vovels { public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println(“Enter any Character”); char xy=sc.next( ).charAt(0); { if(xy==’a’||xy==’e’||xy==’i’||xy==’o’||xy==’u’||xy==’A’||xy==’E’||xy==’I’||xy==’O’|| xy==’U’) { System.out.println(xy+” is Vowel”); } else … Read more

Java program to check Leap year or not

 Java program to check Leap year or not 1. Java program to check Leap year or not using if-else statement: Program: import java.io.*; import java.util.*; class LeapYear { public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println(“Enter the year”); int yr=sc.nextInt(); if((yr%400==0)||(yr%100!=0 && yr%4==0)) { System.out.println(yr+ ” is a leap year”); } else { System.out.println(yr+” … Read more

Java program to print Ascii Table

 Java program to print Ascii Table 1. Java program to print Ascii Table using for loop: Program: import java.io.*; import java.lang.*; class AsciiTable { public static void main(String args[]) { for(int i=0; i<=255;i++) { char ch=(char)i; System.out.println(i+”\t”+ch); } } } Output: . . . . . 48 0 49 1 50 2 . . . … Read more

Java program to check the number is equal to 2000 or not

 Java program to check the number is equal to 2000 or not 1. Java program to check the number is equal to 2000 or not using if- else statement: Program: import java.io.*; import java.util.*; class EqualsTo { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println(“Enter the number”); int num= sc.nextInt(); if(num==2000) … Read more

Even number from 7 to 700

import java.io.*; class EvenOdd { public static void main(String args[]) { long num; for(num=7;num<=700;num++) { if(num%2==0) { System.out.println(“Even no”+num); } } } }  

Java Program to check Greatest or Equal of Two numbers

 Java Program to check Greatest or Equal of Two numbers  1. Java Program to check Greatest or Equal of Two numbers using if-else if statement: Program: import java.io.*; import java.util.*; class GreatestOfTwo { public static void main(String args[]) { int num1,num2; Scanner sc=new Scanner(System.in); System.out.println(“Enter the value of number1”); num1=sc.nextInt(); System.out.println(“Enter the value of number2”); … Read more

Java Program to print Greatest of two numbers

Java Program to print Greatest of two numbers 1. Java Program to print Greatest of two numbers using if Statement: Program: import java.io.*; import java.util.*; class GreatestOfTwo { public static void main(String args[]) { int num1=20, num2=55, max ; max=num2; if(num1>num2) { max=num1; } System.out.println(“The Greatest of two numbers is “+max); } } Output: The Greatest … Read more

Java Program to calculate Average of three numbers- 6 ways

Java Program to calculate Average of three numbers- 6 ways The java program to calculate average of three numbers has been written in five different ways such as Scanner class, direct value initialization, Buffered Reader class, Command Line argument, methods, and using Constructor. Java Program to calculate Average of three numbers- 6 ways are given below: … Read more

Java Program to Calculate Area of Triangle – 5 different ways

 Java Program to Calculate Area of Triangle – 5 different ways The java program to calculate area of triangle has been written in five different ways such as Scanner class, direct value initialization, Buffered Reader class, Command Line argument, and using Constructor. Java Program to Calculate Area of Triangle – 5 different ways are as … Read more

Java Program to calculate area of circle – 5 different ways

Java Program to calculate area of circle – 5 different ways The java program to calculate area of circle has been written in five different ways such as Scanner class, direct value initialization, Buffered Reader class, Command Line argument, and using Constructor. Java Program to calculate area of circle – 5 different ways are as follows: … Read more