python:
count = 0
for i in range(1, int(input('n = ')) + 1):
count += not i % 2
print(f'{count=}')
C#:
using System;
namespace program;
class Program
{
static void Main ()
int count = 0;
int n = Convert.ToInt32(Console.ReadLine());
for(int i = 1; i <= n; i++)
count += n % i == 0 && i % 2 == 0 ? 1 : 0;
}
Console.WriteLine($"count = {count}");
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
python:
count = 0
for i in range(1, int(input('n = ')) + 1):
count += not i % 2
print(f'{count=}')
C#:
using System;
namespace program;
class Program
{
static void Main ()
{
int count = 0;
int n = Convert.ToInt32(Console.ReadLine());
for(int i = 1; i <= n; i++)
{
count += n % i == 0 && i % 2 == 0 ? 1 : 0;
}
Console.WriteLine($"count = {count}");
}
}