Cod sursa(job #3000563)
Utilizator | Data | 12 martie 2023 16:21:30 | |
---|---|---|---|
Problema | Parcurgere DFS - componente conexe | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <iostream>
using namespace std;
int f(int x)
{
int n;
if(x>0)
{
if(x%2==0)
{
cout<<x%10;
n=1+f(x/10);
}
else
{
n=1+f(x/10);
cout<<x%10;
}
return n;
}
else
return 0;
}
int main()
{
cout<<' '<<f(8174);
return 0;
}