Assignment #105 and Evenness Function
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Evenness Function
///File Name: Evenness.java
///Date Finished: 12/1/15
public class Evenness
{
public static void main ( String[] args )
{
boolean even, three;
for ( int n = 1; n <= 20; n += 1 )
{
even = isEven(n);
three = isDivisibleBy3(n);
System.out.print(n);
if ( even == true )
System.out.print("<");
if ( three == true )
System.out.print("=");
System.out.println();
}
}
public static boolean isEven( int n )
{
if ( ( n % 2 ) == 0 )
return true;
else
return false;
}
public static boolean isDivisibleBy3( int n )
{
if ( ( n % 3 ) == 0 )
return true;
else
return false;
}
}
Picture of the output