Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp4
- {
- class Program
- {
- static double Pomnoz2(double[] tab, int i = 0)
- {
- if (tab.Length == 0)
- {
- return 0;
- }
- if (i <= tab.Length - 1)
- {
- if (tab[i] % 7 == 0 || tab[i] % 3 == 0)
- {
- return tab[i] * Pomnoz2(tab, i + 1);
- }
- else
- {
- return Pomnoz2(tab, i + 1);
- }
- }
- else
- {
- int licz = 0;
- for (int k = 0; k < tab.Length; k++)
- {
- if (tab[k] % 7 == 0 || tab[k] % 3 ==0 )
- {
- licz++;
- }
- }
- if (licz != 0)
- {
- return 1;
- }
- else
- return 0;
- }
- }
- static void Main(string[] args)
- {
- double[] tab = { 5,5,5,5,5 };
- Console.WriteLine(Pomnoz2(tab));
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement