C
C#3y ago
4

Write a method that finds the product of an array or set of numbers sent as a parameter and prints

i can't wrote this
2 Replies
4
4OP3y ago
using System.Data;
using System.Text;

namespace hasil
{
public class calculate
{


static void arr()
{

Console.Write("How many numbers do you want to multiply?:");

int limit = Convert.ToInt32(Console.ReadLine());


int[] number = new int[limit];



for (int i = 0; i < limit; i++)
{
Console.Write($"Number{i + 1}:");
number[i] = Convert.ToInt32(Console.ReadLine());

}


Console.Write("----------------------\nResult: ");

for (int i = 0; i < limit; i++)
{


Console.Write($"{number[i]}");
Console.Write("*");


}
Console.WriteLine();
int d = 1;
for (int i = 1; i <= limit ; ++i)
{
d*=number[i];

Console.WriteLine(i);
}
}





public static void Main()
{


arr();




}



}
}
using System.Data;
using System.Text;

namespace hasil
{
public class calculate
{


static void arr()
{

Console.Write("How many numbers do you want to multiply?:");

int limit = Convert.ToInt32(Console.ReadLine());


int[] number = new int[limit];



for (int i = 0; i < limit; i++)
{
Console.Write($"Number{i + 1}:");
number[i] = Convert.ToInt32(Console.ReadLine());

}


Console.Write("----------------------\nResult: ");

for (int i = 0; i < limit; i++)
{


Console.Write($"{number[i]}");
Console.Write("*");


}
Console.WriteLine();
int d = 1;
for (int i = 1; i <= limit ; ++i)
{
d*=number[i];

Console.WriteLine(i);
}
}





public static void Main()
{


arr();




}



}
}
How do I write a method and then use it?
IcyPhoenix
IcyPhoenix3y ago
might wanna look into the hell world interactive tutorial
Want results from more Discord servers?
Add your server