Сделал в VS 2016
Вариант с использованием While
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int a = Convert.ToInt32(Console.ReadLine());
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" ");
while (a <= b)
{
if (a % 3 == 0)
{
Console.WriteLine(a);
}
a++;
}
Console.ReadKey(); }
}
}
Вариант с использованием do while
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int a = Convert.ToInt32(Console.ReadLine());
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" ");
do
{
if (a % 3 == 0)
{
Console.WriteLine(a);
}
a++;
}
while (a <= b); Console.ReadKey();
}
}
}
Вариант с использованием for
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int a = Convert.ToInt32(Console.ReadLine());
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" ");
for (int i = a; i <= b; i++)
{
if (i % 3 == 0)
{
Console.WriteLine(i);
}
} Console.ReadKey();
}
}
}
Ответ:
#include <iostream>
using namespace std;
int main()
{
int sum=0;
for (int i = 100; i <= 200; i++)
{
if (i % 17 == 0)
sum += i;
}
cout << sum;
}
Объяснение:
B1A (16)<span> = </span>230<span>122 (4)
</span>D (16)<span> = 31 (4)</span>
Ну вот шаблон, и решение по 2й задаче, И скрин результатов работы.
P.S. С кодировками кириллицы могут быть проблемы.