#include <iostream>
int main()
{
using namespace std;
const string password = "123456";
string attempted;
cout << "Enter correct password" << endl;
for (int i = 0; i < 3; i++)
{
cin >> attempted;
if (attempted == password)
{
cout << "Successful login" << endl;
return 0;
}
else
{
cout << "Wrong password" << endl;
}
}
cout << "Access denied" << endl;
return 0;
}
1 программа:
var a, sum:integer;
begin
writeln('Введите числа (цифра 0 - выход из программы)');
sum:= 0;
readln(a);
while(a <> 0) do begin
sum:= sum + a;
readln(a);
end;
writeln('Сумма чисел = ', sum);
end.
2 программа:
var a, sum:integer;
begin
a:=0;
while(a <= 100) do begin
if (a mod 2 = 0) then
sum:= sum + a;
a:= a + 1;
end;
writeln('Сумма четных чисел = ', sum);
end.
3 программа:
var a, i, N:integer;
begin
writeln('Введите N');
readln(N);
a:=1;
for i:=1 to N do begin
write(a*a, ' ');
a:= a + 1;
end;
end.