.编写一个控制台应用。输入一组整数,输出所有的奇数。
提示:使用字符串的Split函数
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
namespace test
{
class Program
{
static void Main(string[] args)
{
string str = "";
Console.WriteLine("请输入一组数字,数字与数字之间用空格隔开");
str=Console.ReadLine();
//char[] strS = str.ToCharArray();
string[] strS = str.Split(' ');
Console.WriteLine("奇数有:");
for (int i = 0; i < str.Length; i++)
{
if(Convert.ToInt32(strS[i])%2!=0)
Console.Write("{0} ",strS[i]);
}
Console.ReadKey();
}
}
}