using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Data.SqlClient;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter number
of iteration");
int n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < n ;
i++)
{
Console.WriteLine("Enter lower bound");
int a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter upper
bound");
int b = Convert.ToInt32(Console.ReadLine());
int countResult = 0;
for (int j = a; j <= b; j++)
{
int countEven = 0;
for (int k = 1; k <= j; k++)
{
if (j % k == 0)
{
countEven =
countEven + 1;
}
}
if (countEven % 2 != 0)
{
countResult =
countResult + 1;
}
}
Console.WriteLine("Number of
Interesting number " + countResult);
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment