Răspuns:
1)
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"n = ";
cin >> n;
cout << n * ( n + 1 ) / 2;
}
2)
#include <iostream>
using namespace std;
int main()
{
int n, p = 5, s = 0;
cin >> n;
while(p <= n)
s += n / p, p *= 5;
cout << s;
return 0;
}
3)
#include <iostream>
using namespace std;
int main()
{
int x;
int y;
int s;
cout<<"x = ";
cin>>x;
cout<<"y = ";
cin>>y;
cout<<"s = ";
cin>>s;
while(x < y)
{
x = x + 1;
if(x%s==0)
{
cout<<x<<" ";
}
}
}
Explicație:
Toate sunt facute in C++!
Sper ca te-am ajutat!