***I am having trouble trying to make count3 to only num 2 instead of 5 for the n. But it keeps on printing out num1 to 5. I only want it to show to num 2 since it is the number of times it can divide before reaching 1. Any solutions?

import java.util.Scanner; public class Kid { public static void main(String[] args) { Scanner input = new Scanner(System.in); //Declare variables int sum = 0; System.out.print("Please enter a number for n: "); int n = input.nextInt(); System.out.println("Sum of the first counting numbers: "); for (int count = 1; count <= n; count++){ sum = count + sum; System.out.println("Num: "+count + " Total: "+ sum); } System.out.println("Total sum: "+ sum); System.out.print("\n"); int sumOdd = 0; System.out.println("Sum of first n odd numbers: "); for (int count2 = 1; count2 <= n; count2++){ sumOdd = (2 * count2) - 1; System.out.println("Num: "+ count2+ "(2 * "+ count2 +")" + " - 1" + " Total: "+ sumOdd); } System.out.println("Total sum of odd number: "+ sumOdd); System.out.print("\n"); int numDivided = 0; [System.out.println("Number of times n can be divided: "); for (int count3 = 1; count3 <= n; count3++){ numDivided = n / 2; System.out.println("Num: "+count3); } System.out.println(n + " can be divided by "+ numDivided + " times before reaching 1.");] } }

This post has been edited by **jon.kiparsky**: 05 February 2016 - 02:21 PM

Reason for edit:: added [code] tags