Var n,a,b,c:integer;
begin
write('введите длину интервала: ');
readln(n);
a:=0;
c:=1;
for b:=1 to n do begin
if (b mod 3 =0) then a:=a+b;
if (b mod 2=0) then c:=c*b;
end;
writeln('сумма делящихся на 3=> ',a);
writeln('произведение делящихся на 2=> ',c);
end.
var s:string;
i,n,max:byte;
begin
n:=0;i:=1;max:=0;
write('Введите s -> ');readln(s);
while i<=length(s) do begin
if (i=1) or (s[i]=' ') then begin
if i <> 1 then inc(i);
if (i<=length(s))and((s[i]='a') or (s[i]='A')) then
while i<=length(s) do
if s[i]<>' ' then begin
inc(n);
inc(i);
end else break;
end;
inc(i);
if max<n then max:=n;
n:=0;
end;
write('Длина самаго длинного слова на букву A = ',max);
end.
Ответ:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int n, k, chastnoe, ostatok;
cout << "Введите делимое N = ";
cin >> n;
cout << "Введите делитель K = ";
cin >> k;
if (k != 0)
{
int tmp = n;
chastnoe = ostatok = 0;
while (tmp >= k)
{
tmp -= k;
chastnoe++;
}
ostatok = tmp;
}
cout << "Частное от деления: " << chastnoe << endl;
cout << "Остаток от деления: " << ostatok << endl;
return 0;
}
Объяснение: