Problema 15
#include<iostream>22, 23, 24
using namespace std;
int a,b,n;
double A(int);
double B(int);
int main()
{int i;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"n=";cin>>n;
for(i=1;i<=n;i++)
{cout<<A(i)<<" "<<B(i);
cout<<endl;}
}
double A(int n)
{if(n==0)
return a;
else return (A(n-1)+B(n-1))/2;
}
double B(int n)
{if(n==0)
return b;
else return sqrt(A(n-1)*B(n-1));
}
#include<iostream>
using namespace std;
int p=0;
int s=0;
void afisare(int n, int i)
{
if(n%i==0)
cout<<i<<" ";
if(i<=n)
afisare(n,++i);
}
int numarare(int n, int i)
{
if(n%i==0)
p++;
if(i<=n)
numarare(n,++i);
return p;
}
int suma(int n, int i)
{
if(n%i==0)
s=s+i;
if(i<=n)
suma(n,++i);
return s;
}
int main()
{int n,i=1;
cin>>n;
afisare(n,i);
cout<<endl<<"NR DIVIZORI "<<numarare(n,i)<<endl;
cout<<"SUMA DIVIZORILOR "<<suma(n,i);
}