fork download
  1. using static System.Console;
  2.  
  3. namespace revisao {
  4. public class Program {
  5. public static void Main(string[] args) {
  6. Write("Digite o tamanho do vetor: ");
  7. if (int.TryParse(ReadLine(), out var tamanho)) {
  8. int[] vetor = new int[tamanho];
  9. for(int i = 0; i < vetor.Length; i++) {
  10. Write($"Digite o elemento {i}: ");
  11. vetor[i] = int.TryParse(ReadLine(), out var valor) ? valor : 0;
  12. }
  13. Imprimir(vetor);
  14. }
  15. }
  16. private static void Imprimir(int[] vetor) {
  17. WriteLine("Valores divisíveis por 2 e 3 simultaneamente");
  18. foreach (var item in vetor) if (item % 6 == 0) WriteLine($"{item}");
  19. }
  20. }
  21. }
  22.  
  23. //https://pt.stackoverflow.com/q/244426/101
Success #stdin #stdout 0.02s 15980KB
stdin
Standard input is empty
stdout
Digite o tamanho do vetor: