-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCódigo Exercício 1.cs
41 lines (40 loc) · 1.22 KB
/
Código Exercício 1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lista_de_Exercícios_3___ATP
{
internal class Program
{
static void Main(string[] args)
{
int x, y, num1, num2;
Console.WriteLine("Informe o primeiro número (ímpar)");
x = int.Parse(Console.ReadLine());
Console.WriteLine("informe o segundo número (ímpar)");
y = int.Parse(Console.ReadLine());
num1 = x % 2;
num2 = y % 2;
if (num1 == 0 || num2 == 0 || x > y)
{
Console.WriteLine("Erro! Valor inválido");
}
else if (num1 != 0 && num2 != 0)
{
Console.WriteLine("os números ímpares entre os dois números são: ");
while (x <= y)
{
num1 = x % 2;
num2 = y % 2;
if (num1 != 0 && num2 != 0)
{
Console.Write(x + " ");
}
x++;
}
}
Console.ReadLine();
}
}
}