For loops #84 (Counting with even indicator)

Code

/// Name: Amir Salehi
/// Period: 7
/// Program Name:Noticing Even Numbers
/// File Name:NoticeNumbers.java
/// Date Finished: 2/9/2016

    import java.util.Scanner;
    
    public class NoticeNumbers
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            
            System.out.println();
            
            for ( int n = 1 ; n <= 20 ; n = n+1 )
            {
                if ( n%2 == 0 )
                {
                    System.out.println( n + " < " );
                }
                
                else
                {
                    System.out.println( n );
                }
            }
        }
    }  
    

Picture(s) of the output

Assignment 7

Back to Homepage