using System;
namespace sum_of_dividends
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Введите начальное число");
var a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите конечное число");
var b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите кратное число");
var c = Convert.ToInt32(Console.ReadLine());
var sum = 0;
for (var x = a; x <= b; x++)
if ((x % c) == 0)
sum += x;
Console.WriteLine(sum);
}
}
}
using System;
namespace sum_of_dividends
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Введите начальное число");
var a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите конечное число");
var b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите кратное число");
var c = Convert.ToInt32(Console.ReadLine());
var sum = 0;
for (var x = a; x <= b; x++)
switch (x % c)
{
case 0: sum += x; break;
default: break;
}
Console.WriteLine(sum);
}
}
}
using System;
namespace sum_of_dividends
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Введите начальное число");
var a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите конечное число");
var b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Введите кратное число");
var c = Convert.ToInt32(Console.ReadLine());
var sum = 0;
var x = a;
while (x <= b)
{
switch (x % c)
{
case 0: sum += x; break;
default: break;
}
x++;
}
Console.WriteLine(sum);
}
}
}
Гугл не дает четкого ответа, так как migwiz в 10 нет, и замены ей тоже нет.windows 10 перенос профиля
Исключение это и есть ошибка?запланированная возможности ошибки (обычно высоко вероятной)
Exception
думали именно такstatic void print(this string s, string pfx = "", string sfx = "") => Console.WriteLine(pfx + s + sfx);
static void print(this IEnumerable<string> sa, string pfx = "", string sfx = "") => sa.ToList().ForEach(s => s.print(pfx, sfx));
static void print(this string s) => Console.WriteLine(s);
static void print(this IEnumerable<string> sa) => sa.ToList().ForEach(s => s.print());
using System;
using System.Diagnostics;
using System.Linq;
namespace ff.links
{
static partial class Program
{
static void Main(string[] args)
{
var sw = new Stopwatch();
sw.Start();
"let's begin...".print();
var finds = fromTypical().scan();
"find targets is ".print(pfx, finds.Count().ToString());
//finds.print();
var bro = finds.Where(b => b.Contains(ffBinary));
"find browsers is ".print(pfx, bro.Count().ToString());
bro.print(pfx);
var cfg = finds.Where(b => b.Contains(fflConfig));
"find configs is ".print(pfx, cfg.Count().ToString());
cfg.print(pfx);
var profiles = finds.Where(b => b.Contains(ffProfileSign));
"find profiles is ".print(pfx, profiles.Count().ToString());
//profiles.print();
profiles.buildLinks(bro.First());
//profiles.prefsApplay();
//links2start();
sw.Stop();
var ts = sw.Elapsed;
$"RunTime {ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}.{ts.Milliseconds:000}".print();
//#if DEBUG
// "press any key to continue...".print();
// Console.ReadKey();
//#endif
}
const string pfx = " ::> ";
}
}
Назовем натуральное число палиндромом, если его запись читается одинаковопро 393,1 не понятно
сначала и с конца (например: 4884, 393,1)
Где ошибка в коде?ошибки и в коде, ошибки в ходе мыслей
b
мало того что вы его не меняете, вы его еще и всегда обнуляете!!!using System;
using System.Linq;
namespace palindrome
{
class Program
{
static void Main(string[] args)
{
int p = 0;
string q = default, r = default;
for (int i = 1; i < 100; i++)
if ((q = (i * i).ToString()) == (r = new string(q.Reverse().ToArray())))
Console.WriteLine($"palindrome {++p} q={q} == r={r}"); ;
Console.WriteLine($"total: {p}");
}
}
}