1. Engineering
  2. Computer Science
  3. how can i fix the spacing issue between the last...

Question: how can i fix the spacing issue between the last...

Question details

How can I fix the spacing issue between the last input and the colon on this part

System.out.print("Bar graph for "); for(int i=0; i 0; height--) { for(int i=0; i= height) { System.out.printf("%3s", "#"); } else { System.out.printf("%3s", " "); } } . While keeping the spacing between the numbers. Here is the rest of the code

import java.util.Scanner; public class BarGraph2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Number of values to graph: "); int n = in.nextInt(); int data[] = new int[n]; int max = 0; for(int i=0; i 0; height--) { for(int i=0; i= height) { System.out.printf("%3s", "#"); } else { System.out.printf("%3s", " "); } } System.out.println(); } for(int i=0; i

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution