using System;
namespace st
{
public class ArrayCount
{
public static void Main()
{
int[] a = new int[10];
for (int i = 0; i < a.Length; i++)
{
Console.Write("Enter a number :");
a[i] = Int32.Parse(Console.ReadLine());
}
int nop, non, noz;
nop = non = noz = 0;
foreach (int n in a)
{
if (n > 0)
nop++;
else
if (n < 0)
non++;
else
noz++;
}
Console.WriteLine("No. of positives : {0}", nop);
Console.WriteLine("No. of negatives : {0}", non);
Console.WriteLine("No. of zeroes : {0}", noz);
} // main
} // class
} // namespace
Comments
Post a Comment