anoop kumar

anoop kumar

  • NA
  • 19
  • 2.8k

Scenairo - Print odd numbers from user input number.

Aug 29 2018 3:35 AM
class Program
{
static void Main(string[] args)
{
int regen, result;
Console.WriteLine("Enter the Number");
int getnum = Convert.ToInt32(Console.ReadLine());
while (getnum > 0)
{
regen = getnum % 10;
result = regen;
getnum = getnum / 10;
if (result % 2 != 0)
{
Console.WriteLine("These are the Odd Numbers" + result);
}
}
Console.ReadKey();
}
}
 
 

Answers (9)