Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp6
- {
- class Program
- {
- static void Main(string[] args)
- {
- /*
- *С помощью params сделать возможным передачу любого количества цифр в метод.
- * В самом методе умножить все принятые цифры и вернуть их произведение.
- */
- int[] a = { 1, 3, 56, 8, 12 };
- Console.WriteLine(SomeMul(a));
- }
- static int SomeMul(params int[] a)
- {
- int b = 1;
- for (int i = 0; i < a.Length; i++)
- {
- b = b * a[i];
- }
- return b;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement