Перевести программу с языка Си на язык Паскаль #include
#include
#define nx (25)
#define x(a,b) b a
x(main,int)() { x(x(x([nx],[nx]),a),int);x(n,int);x(r,int);x(c,int);x(("n? "),printf);
x(("%d",&n),scanf);x((r=0;r < n ;++r),for) { x((c=0;c < n;++c),for) { x((r==c),if) a[r][c] = r;
else a[r][c]=0;printf("%""4""d",a[r][c]); } puts(""); } return(0); }
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int n, n_copy, min1, min2, temp;
min1 = 9; min2 = 9;
cout << "Введите число: "; cin >> n;
n_copy = n;
while (n > 0) {
temp = n % 10;
if (temp < min1)
min1 = temp;
n = n / 10;
}
cout << "Первое минимальное = " << min1 << endl;
n = n_copy;
int b = 0;
while (n) {
if (n % 10 != min1) b = b * 10 + n % 10;
n /= 10;
}
while (b) {
n = n * 10 + b % 10;
b /= 10;
}
while (n > 0) {
temp = n % 10;
if (temp < min2)
min2 = temp;
n = n / 10;
}
cout << "Второе минимальное = " << min2 << endl;
int sum = min1 + min2;
if (sum % 2 == 0)
cout << "Сумма двух минимальных цифр " << min1 << "+" << min2 << "=" << sum << " четная." << endl;
else
cout << "Сумма двух минимальных цифр " << min1 << "+" << min2 << "=" << sum << " не четная." << endl;
system("pause");
return 0;
}