var a, b, c: integer;
begin
read(b,c);
if (c>0)and(c<0) then a:=b/c write(a) else write('c=0');
end.
Это для паскаля
Вариант на C++. В данном случае отличия С от С++ минимальны, возможно, что тут только потребуется заменить cin на scanf и cout на printf. Ну и библиотеки.
Числа вводятся в 4-ёх элементный массив, потом он сортируется и выводится.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
void sort(int*, const int);
int main()
{
const int arraySize = 4;
int a[arraySize];
cout << "Enter the four numbers: ";
for(int i = 0; i < arraySize; i++)
{
cin >> a[i];
}
cout << endl;
sort(a, arraySize);
return 0;
}
void sort(int *a, const int size)
{
int temp, smallest;
for(int i = 0; i < size - 1; i++)
{
smallest = i;
for(int j = i + 1; j < size; j++)
{
if(a[smallest] > a[j])
{
smallest = j;
}
}
temp = a[i];
a[i] = a[smallest];
a[smallest] = temp;
}
for(int i = 0; i < size; i++)
{
cout << a[i] << ' ';
}
cout << endl;
}
Опять вся табуляция позбивалась...
begin
var (b, c) := ReadReal2;
if c <> 0 then Write('a=', b / c)
else Print('с=0')
end.