Language: C++

import java.util.Scanner;

class Main {
	
	public static void main(String[] a) {
	
		String input;
		int datasetCount = 0;
		
		
		Scanner stdin = new Scanner(System.in);
		while (++datasetCount <= 30) {
			int primes = 0;
			input = stdin.nextLine();
			try {
				int n = Integer.parseUnsignedInt(input);
				
				if (n > 999999)
					break;
				
				for (int i = 2; i <= n; ++i) {
					
					if (isPrime(i))
						++primes;
					
				}
				
				System.out.print(primes);
				
				
			} catch (NumberFormatException nfe) {
				break;
			}
		}
		stdin.close();
	}
	
	
	private static boolean isPrime(int i) {
	
		for (int div = 2; div <= Math.sqrt(i); ++div) {
			if (i % div == 0)
				return false;
		}
		return true;
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:15: error: expected ':' before 'static'
    5 |         public static void main(String[] a) {
      |               ^~~~~~~
      |               :
a.cc:5:33: error: 'String' has not been declared
    5 |         public static void main(String[] a) {
      |                                 ^~~~~~
a.cc:5:42: error: expected ',' or '...' before 'a'
    5 |         public static void main(String[] a) {
      |                                          ^
a.cc:39:16: error: expected ':' before 'static'
   39 |         private static boolean isPrime(int i) {
      |                ^~~~~~~
      |                :
a.cc:39:24: error: 'boolean' does not name a type; did you mean 'bool'?
   39 |         private static boolean isPrime(int i) {
      |                        ^~~~~~~
      |                        bool
a.cc:47:2: error: expected ';' after class definition
   47 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:7:17: error: 'String' was not declared in this scope
    7 |                 String input;
      |                 ^~~~~~
a.cc:11:17: error: 'Scanner' was not declared in this scope
   11 |                 Scanner stdin = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:14:25: error: 'input' was not declared in this scope; did you mean 'int'?
   14 |                         input = stdin.nextLine();
      |                         ^~~~~
      |                         int
a.cc:14:33: error: 'stdin' was not declared in this scope
   14 |                         input = stdin.nextLine();
      |                                 ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | import java.util.Scanner;
a.cc:16:41: error: 'Integer' was not declared in this scope
   16 |                                 int n = Integer.parseUnsignedInt(input);
      |                                         ^~~~~~~
a.cc:23:45: error: 'isPrime' was not declared in this scope
   23 |                                         if (isPrime(i))
      |                                             ^~~~~~~
a.cc:28:33: error: 'System' was not declared in this scope
   28 |                                 System.out.print(primes);
      |                                 ^~~~~~
a.cc:31:34: error: 'NumberFormatException' does not name a type
   31 |                         } catch (NumberFormatException nfe) {
      |                                  ^~~~~~~~~~~~~~~~~~~~~
a.cc:35:17: error: 'stdin' was not declared in this scope
   35 |                 stdin.close();
      |                 ^~~~~
a.cc:35:17: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'