Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int num, a, b, c;
- Console.Write("Enter a: ");
- a = int.Parse(Console.ReadLine());
- Console.Write("Enter b: ");
- b = int.Parse(Console.ReadLine());
- Console.Write("Enter c: ");
- c = int.Parse(Console.ReadLine());
- int sumOfOddNumber = 0;
- int productOfPositiveNumbers = 1;
- do
- {
- Console.Write("Enter number: ");
- num = int.Parse(Console.ReadLine());
- if (num % 2 == 1)
- {
- sumOfOddNumber += num;
- }
- if (num > 0)
- {
- productOfPositiveNumbers *= num;
- }
- } while (num != 0);
- Console.WriteLine("Sum of all odd numbers is: {0}", sumOfOddNumber);
- Console.WriteLine("Sredno geometrichno na 8-te polojitelni chisla e: {0:0.00}", Math.Pow(productOfPositiveNumbers, 1 / 8));
- Console.WriteLine("Sss(|a - b|) * Sss(b + c) = {0}",
- (Sss(Math.Abs(a - b)) * Sss(b + c)));
- }
- private static int Sss(int k)
- {
- Random rnd = new Random();
- int product = 1;
- for (int i = 0; i < k; i++)
- {
- int num = rnd.Next(-50, 150);
- if (num.ToString().Count() == 2)
- {
- if (num.ToString()[1] == '5')
- {
- product *= num;
- }
- }
- }
- return product;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement