class Program
{
static void Main(string[] args)
{
int x, count = 0;
Console.WriteLine("Enter the Limit : ");
x = int.Parse(Console.ReadLine());
int[] a = new int[m];
Console.WriteLine("Enter the Numbers :");
for (int i = 0; i < m; i++)
{
a[i] = Convert.ToInt32(Console.ReadLine());
}
foreach (int o in a)
{
if (o == 1)
{
count++;
}
}
Console.WriteLine("Number of 1's in the Entered Number : ");
Console.WriteLine(count);
Console.ReadLine();
}
}
---------------------
OUTPUT
Enter the Limit : 6
Enter the Numbers :
1
2
1
4
1
2
Number of 1's in the Entered Number : 3
--------------------
{
static void Main(string[] args)
{
int x, count = 0;
Console.WriteLine("Enter the Limit : ");
x = int.Parse(Console.ReadLine());
int[] a = new int[m];
Console.WriteLine("Enter the Numbers :");
for (int i = 0; i < m; i++)
{
a[i] = Convert.ToInt32(Console.ReadLine());
}
foreach (int o in a)
{
if (o == 1)
{
count++;
}
}
Console.WriteLine("Number of 1's in the Entered Number : ");
Console.WriteLine(count);
Console.ReadLine();
}
}
---------------------
OUTPUT
Enter the Limit : 6
Enter the Numbers :
1
2
1
4
1
2
Number of 1's in the Entered Number : 3
--------------------
No comments:
Post a Comment