C#输入一组非0整数(以0作为输入结束标志)到一维数组中,求出这一组数的平均值,统计出正数和负数的个数.

C#输入一组非0整数(以0作为输入结束标志)到一维数组中,求出这一组数的平均值,统计出正数和负数的个数.
如,输入4,5,6,0,则输出 5
是C#的问题,求解
其他人气:613 ℃时间:2019-08-17 16:30:10
优质解答
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace baidu_shurutongji{    class Program    ...int n;int sum = 0;int[] count=new int[1000];int pos = 0;int neg=0;Console.WriteLine("请输入(以0作为输入结束标志)");n = int.Parse(Console .ReadLine ());for (int i = 0; n != 0;i++ ){count[i] = n;sum = sum + n;if (n > 0) pos++;
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版