Hello! Mam taki kod , czy ten kod jest rekurencją?
int main()
{
int i;
scanf("%d",&i);
int count = 0;
while (i)
{
if (i & 1) count++;
i = (i >> 1);
}
printf("%d", count);
return 0;
}
Hello! Mam taki kod , czy ten kod jest rekurencją?
int main()
{
int i;
scanf("%d",&i);
int count = 0;
while (i)
{
if (i & 1) count++;
i = (i >> 1);
}
printf("%d", count);
return 0;
}
Nie.
Rekurencja polega na wywołaniu przez funkcję samej siebie