anoop kumar

anoop kumar

  • 1.9k
  • 19
  • 737

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();
}
}
 
 

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (9)