Răspuns :
Hai ca nu e greu, incearca sa-ti imaginezi algoritmul in pseudo-cod mai intai si apoi e easy...
#include<iostream>
using namespace std;
int main()
{
int n, k = 5, zero = 0;
cin >> n;
while(n / k) {
zero += n / k;
k *= 5;
}
cout << zero;
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int n, k = 5, zero = 0;
cin >> n;
while(n / k) {
zero += n / k;
k *= 5;
}
cout << zero;
return 0;
}
Programu' lu AntiEagles tradus in limba lu' Pascal
program no_cum_vrei_sa_ii_zici;
var
n,k,zero:integer;
check:boolean;
begin
k := 5;
zero := 0;
check := true;
readln(n);
while check do
begin
zero := zero + round(Int(n / k));
k := k*5;
if round(Int(n/k))=0 then
begin
check := false;
end;
end;
writeln(zero);
end.
PS: My first Pascal app :D
program no_cum_vrei_sa_ii_zici;
var
n,k,zero:integer;
check:boolean;
begin
k := 5;
zero := 0;
check := true;
readln(n);
while check do
begin
zero := zero + round(Int(n / k));
k := k*5;
if round(Int(n/k))=0 then
begin
check := false;
end;
end;
writeln(zero);
end.
PS: My first Pascal app :D