JAVA ONLINE COMPILER
JAVA ONLINE COMPILER
LARGEST OF 2 NUMBERS :
public class Main
{
public static void main (String[] args)
{
int num1 = 50, num2 = 20;
if (num1 == num2)
System.out.println (“both are equal”);
else if (num1 > num2)
System.out.println (num1 + ” is greater”);
else
System.out.println (num2 + ” is greater”);
}
}
//PROGRAM TO FIND THE FACTORIAL OF NUMBER USING WHILE LOOP//
public class TestFacto
{public static void main(String[] args)
{
int number = 5;
long fact = 1;
int i = 1;
while(i<=number)
{
fact = fact * i;
i++;
}
System.out.println(“Factorial of “+number+” is: “+fact);
}
}
// JAVA PROGRAM TO FIND THE AREA OF RECTANGLE //
class AreaOfRectangle2
{
public static void main (String[] args)
{
double length = 4.5;
double width = 8.0;
double area = length*width;
System.out.println(“Area of Rectangle is:”+area);
}
}
All of u write program and anything related to program and execution.. u can discuss using comments
well constructed website and it is easy to use and understand.
THANKU BHAGYASHREE