class Factorial
{ public static void main(String s[])
{
System.out.println("Factorial of 5 is " + factorial(5));
}
public static int factorial(int number)
{
int result = 1;
//Write code here to calculate the factorial and assign it to result
return result;
}
}
class AddNumbers
{ public static void main(String s[])
{
System.out.println("Sum of 21 and 18 is " + sum(21, 18));
}
public static int sum(int a, int b)
{
int result = 0;
//Write code here sum a and b and assign it to result
return result;
}
}
class ThreeNumbersAverage
{ public static void main(String s[])
{
System.out.println("Average of 15, 70 and 27 is " + average(15, 70, 27));
}
public static int average(int a, int b, int c)
{
int result = 0;
//Write code here to get the average of a, b and c and assign it to result
return result;
}
}
class IsPrime
{ public static void main(String s[])
{
System.out.println(prime(37) ? "37 is prime" : "37 is not prime");
}
public static boolean prime(int input)
{
boolean result = false;
//Write code here to assign true to the variable result, if input is prime otherwise assign false.
return result;
}
}
class Test1
{
public static void main(String s[])
{
float f = 75.0f;
double d = 75.0;
int i = 75;
if( f == d )
{
if( f == i )
{
System.out.println("f, d and i are equal");
}
else
{
System.out.println("f, d are equal but i is not equal");
}
}
else
{
System.out.println("f and d are not equal");
}
}
}
A. | f, d are equal but i is not equal |
B. | f, d and i are equal |
C. | f and d are not equal |
D. | Program does not compile since data types are different |