Переменная х последовательно принимает значение: -1, 3, -1, 0, 4.чему будет равна переменная s после исполнения алгоритма? s: =0; повтори 5 [если х> 0 то s: =s+x]ответы: 1)7 3)02)-1 4)5
Var n,count,i: integer; a: array[1..100] of integer; begin randomize; write ('введите n: '); readln (n); count: =0; for i: =1 to n do begin a[i]: =random(1,10); write (a[i],' '); // для наглядности. можно удалить if (a[i]> 5) and (a[i] mod 2 =1) then begin a[i]: =7; count: =count+1 end end; writeln; for i: =1 to n do write (a[i],' '); writeln; writeln ('count = ',count); end. пример: введите n: 10 1 9 6 9 9 4 8 8 9 6 1 7 6 7 7 4 8 8 7 6 count = 4
Вводите путь к файлу, кол-во букв и цифр будет в консоли и в конце файла
using System;
using System.IO;
using System.Text;
namespace Program
{
class Program
{
static void Main(string[] args)
{
string inputFilePath = Console.ReadLine();
string inputStr = File.ReadAllText(inputFilePath);
int letters = 0, digits = 0;
foreach (var s in inputStr)
{
if (char.IsLetter(s))
++letters;
else if (char.IsDigit(s))
++digits;
}
File.AppendAllText(inputFilePath, $"Letters: {letters}, Digits: {digits}");
Console.WriteLine($"Letters: {letters}\n\rDigits: {digits}\n\r");
Console.ReadKey();
}
}
}