68 401
Assignments Done
98,5%
Successfully Done
In December 2018

Answer to Question #23033 in Delphi | Pascal for Jack Lee

Question #23033
Free Pascal assignment.

Basically, the task is:

We're given integer N. For integer D > 0 we say that he is divisor for N, if D divides N. What is the arithmetic mean of all the divisors of the given number N?

Input: One and only row of the standard input contains integer N (1<=N<=10^9).

Output: In a single line of standard output to print arithmetic mean of divisors given natural number. Number printed with an accuracy of two decimal places.

Please, I need help.
Expert's answer
program pr1; USES CRT;
var N,k,i:integer; s:real;
begin CLRSCR;
readln(N);
for i := 1 to N do
if (N mod i = 0) then begin
s:=s+i;
k:=k+1;

end;
s:=s/k;
write (s:9:2);
end.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions