Assignemnt #83 Xs and Ys
Code
Name: Iaroslav Titov
Period: 7
Project Name: XandY
File Name: XandY.java
Date: 1/11/2015
import java.util.Scanner;
public class XandY
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int countFrom = -10;
int countTo = 10;
float countBy = .5f;
System.out.print(" x y\n ");
System.out.print("---------------\n ");
for(int i = 0; i <= countTo/countBy - countFrom/countBy; i++)
{
System.out.print(((countFrom + countBy*i) < 10?" ":"") + (countFrom + countBy*i) + " ");
System.out.print((countFrom + countBy*i)*(countFrom + countBy*i)+"\n ");
}
System.out.print("\n ");
}
}
Picture of the output