I really would appreciate if someone could help to find a solution to the following code:
using System;
using System.Collections.Generic;
class HelloWorld {
static void Main() {
Console.WriteLine("Calculador de Números Primos");
int n = Console.ReadLine("Escreva um número inteiro:\n");
public bool isPrimo(int x) {
var dvs = new List<int>();
for (int d = 1; d < x+1; d++) {
if (x % d == 0) {
dvs.Add(d);
}
}
if (dvs.Count == 2) {
return true;
}
return false;
}
for (int a = 1; a < n; a++) {
if (isPrimo(a)) {
Console.WriteLine(a);
}
}
if (isPrimo(n)) {
Console.WriteLine($"O número {n} É PRIMO");
} else {
Console.WriteLine($"O número {n} NÃO É PRIMO");
}
}
}
The problem is that it doesn't understand the code in bold as a method declaration.