freetimestudys@gmail.com          +91-7097633380
  Login Here                        

area of the circle

import java.io.*;
class clsarea
{
public static void main(String args[])throws IOException
{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
float r,a;
System.out.println("Enter the radius:");
r=Float.parseFloat(br.readLine());
a=3.14f*r*r;
System.out.println("Area is "+a);
}}

intput and output

Enter the radius:
10
Area is 314.0

check whether the no is even or odd

import java.io.*;
class clsevenodd
{public static void main(String args[])throws IOException
{BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
int n;
System.out.println("Enter the no:");
n=Integer.parseInt(br.readLine());
if(n%2==0)
{
System.out.println("EVEN");}
if(n%2==1)
{System.out.println("ODD");}
}
}

intput and output

Enter the no:
10
EVEN
Enter the no:
9
ODD

print the greatest number

import java.io.*;
class gtn
{
public static void main(String args[])throws IOException
{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
int a,b,c;
System.out.println("Enter the values");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
c=Integer.parseInt(br.readLine());
if((a>b)&&(a>c))
{System.out.println("A is greatest");}
else if (b>c)
{
System.out.println("B is greatest");
}
else
{
System.out.println("C is greatest");}}}

intput and output

Enter the values:
12 21 32
C is greatest