In: Computer Science
this need to import Java.util.Scanner; // Display every character between Unicode 65 and 122 // Start new line after 20 characters public class DebugSix2
{ public static void main(String args[]) { char letter; int a; final int MIN = 65; final int MAX = 122; final int NUMPERLINE = 200; final int STOPLINE1 = 0; final int STOPLINE2 = STOPLINE1 + NUMPERLINE; for(a = MIN; a <= MAX; a++) { letter = (char)a; System.out.print(" " + letter); if((a == STOPLINE1) && (a == STOPLINE) System.out.println(); } System.out.println("\nEnd of application"); } }
Java code for above problem
import java.util.Scanner;
// Display every character between Unicode 65 and 122
// Start new line after 20 characters
class DebugSix2
{
public static void main(String args[])
{
char letter;
int a;
final int MIN = 65;
final int MAX = 122;
int MAX_CHAR_PER_LINE=20;
int char_count=0;
for(a = MIN; a <= MAX;
a++)
{
if(char_count ==
MAX_CHAR_PER_LINE)
{
System.out.println();
char_count = 0;
}
letter =
(char)a;
System.out.print(letter + " ");
char_count++;
}
System.out.println("\nEnd of
application");
}
}
Sample output
Mention in comments if any mistakes or errors are found. Thank you.