Reputation: 17
I have written this code to just show the content written inside 'pre' tag and saved it as abc.html
<pre>
public class ReverseArr {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");
for(int i=0;i<n;i++) {
arr[i] = scanner.nextInt();
}
System.out.println("The Entered elements are : ");
for(int i=0;i<n;i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
System.out.println("The reverse of array is : ");
for(int i=n-1;i>=0;i--) {
System.out.print(arr[i] + " ");
}
}
}
</pre>
I ran it in chrome and firefox,But I am getting the output as:
public class ReverseArr {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");/*After that problem occurs*/
for(int i=0;i=0;i--) {
System.out.print(arr[i] + " ");
}
}
}
Why the complete content is not shown in browsers (Chrome, Firefox)? What changes needs to be done to show complete content written inside 'pre' tag in browsers?
Upvotes: 1
Views: 47
Reputation: 6922
As pointed out in the comments, the issue is that the angle brackets (<
and >
) in your code are messing up the HTML layout.
Simply replacing every <
by <
and >
by >
should do it.
Upvotes: 1