For loops #82 (10 to 10)

Code

/// Name: Amir Salehi
/// Period: 7
/// Program Name: Counting By Halfs
/// File Name: CountingByHalfs.java
/// Date Finished: 2/8/2016



public class CountingByHalfs
{
    public static void main( String[] args )
    {
       

        
           int f = -10;
        
           int t = 10;
       
        double b = 0.5;
System.out.println("X");
System.out.println("------------------------------------");
        for ( double x = f; x <= t ; x = x+b )
        {
            System.out.println( x + " " );
        }

    }
}
    

Picture(s) of the output

Assignment 7

Back to Homepage