Assignemnt #82 Half

Code

    /// Name: Caelan Dorstad
    /// Period: 6
    /// Program Name: half
    /// File Name: half.java
    /// Date Finished: 2/19/2016
    
    import java.util.Scanner;
    
    public class half{
        public static void main(String[] args){
            Scanner keyboard = new Scanner(System.in);
            
            int countFrom = -10;
            
            int countTo = 10;
            
            float countBy = .5f;
            
            for (int i=0; i <= countTo/countBy - countFrom/countBy; i++)
            {
                System.out.print(((countFrom + countBy*i) < 10?" ":"")+ (countFrom + countBy*i) + " ");
                if (i % 10 == 0 && i != 0) {
                    System.out.println("\n");
                }
            }
            System.out.print("\n");
        }
    }
            
                               

    

Picture of the output

Assignment 10