题解 | #统计数据正负个数#
统计数据正负个数
https://www.nowcoder.com/practice/3f33889582934a09b4e3ddd3cc976226
public class Program { public static void Main() { string[] line = System.Console.ReadLine().Split(" "); int positive = 0, negative = 0; for(int i=0;i<line.Length;i++) { int num = int.Parse(line[i]); if(num>0) positive+=1; else negative+=1; }; System.Console.WriteLine("positive:"+positive+"\n"+"negative:"+negative); } }