Объяснение:
program Randomizer;
const
RndLimit = 10000;
var
x, SumX : integer;
begin
SumX := 0;
// Коммент: случайное число в паскале всегда генерируется от 0 до заданного но нам необходимо от 1000, поэтому в цикле repeat...until оно будет генерироваться до тех пор, пока не станет > 999
Repeat x := Random(RndLimit) until x > 999;
writeln ('Random X= ', x);
SumX := SumX + (x div 1000) + (x mod 1000 div 100) + (x mod 1000 mod 100 div 10) + (x mod 1000 mod 100 mod 10);
writeln ('Sum = ', SumX);
end.
запускаем
Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling main.pas
Linking a.out
21 lines compiled, 0.1 sec
Random X= 5488
Sum = 25
#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);
}