import java.util.Scanner;
public class twoIntegers
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
//Part A
//Input two integers
System.out.println("Please enter two integers,"
+ "the first must be less than second: ");
//Part B
//All odd numbers between firstNum and secondNum
int firstNum = keyboard.nextInt();
int secondNum = keyboard.nextInt();
int temp = firstNum;
int sum = 0;
String oddNum = "";
int sumSqr = 0;
while(temp <= secondNum)
{
if(temp % 2 != 0)
{
oddNum = oddNum + temp + " ";
}
temp++;
}
System.out.println("The odd numbers are: " + oddNum);
//Part C
//Sum of all even numbers between firstNum and secondNum
temp = firstNum;
while(temp <= secondNum)
{
if(temp % 2 == 0)
{
sum += temp;
}
temp++;
}
System.out.println("The sum of all even numbers: " + sum);
//Part D
//Output the numbers and their square between 1 and 10
int i = 1;
while(i <= 10)
{
System.out.println("" + (i * i));
i++;
}
//Part E
//Output the sum of square of odd numbers
temp = firstNum;
while(temp <= secondNum)
{
if(temp % 2 != 0)
{
sumSqr += temp * temp;
}
temp++;
}
System.out.println("Sum of the square of odd numbers: " + sumSqr);
//Part F
//Output all uppercase letter.
i = 0;
while(i < 26)
{
System.out.println((char) (i + 65));
i++;
}
}
}

--- Update ---

This is my finished program. However the output is correct but messy. How would I output the output horizontally instead of vertically?