Вот тебе простой вариант ришение задачи (коментар=пояснение)
PascalВыделить код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 program prg; uses crt; var rez,chislo,min,max:integer; begin Write('Enter number = ');readln(chislo); //zanosim 1 chislo max:=chislo; //v max ta min min:=chislo; //chtobu potom mu soukb sravnivat s drugimi chislamu while (chislo<>0) do //zapuskaem zikl poka mu ne napishem 0 begin if (chislo>max)then max:=chislo; //sravnivaem s max if (chislo<min) then min:=chislo; //sravnivaem s min readln(chislo); //snova pihem chislo end; rez:=(max-min); //nahodim raznizy writeln('max(',max,') - min(',min,') = ',rez); //otvet end.
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cstring>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>typedef unsigned long long ulol;
typedef long double ld;
typedef long long lol;
typedef long int li;#define mp make_pair
#define F first
#define S second
#define sqr(a) ( (a) * (a) )
#define pb push_back
#define INF 999999999
#define ret(a) cout << endl; system("pause"); return(a)
//#define ret(a) return(a)using namespace std;int main()
{
ld x;
cin >> x;
x = ( 8 / sqrt( x ) ) + sqrt(x);
cout << x;
ret(0);
}
PascalВыделить код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 program prg; uses crt; var rez,chislo,min,max:integer; begin Write('Enter number = ');readln(chislo); //zanosim 1 chislo max:=chislo; //v max ta min min:=chislo; //chtobu potom mu soukb sravnivat s drugimi chislamu while (chislo<>0) do //zapuskaem zikl poka mu ne napishem 0 begin if (chislo>max)then max:=chislo; //sravnivaem s max if (chislo<min) then min:=chislo; //sravnivaem s min readln(chislo); //snova pihem chislo end; rez:=(max-min); //nahodim raznizy writeln('max(',max,') - min(',min,') = ',rez); //otvet end.