Ok, I have a program that gets the factors of a LCD of a number (recursion). I need help converting it to loop statement :( . Any help will be appreciated. and please add an explanation I would really appreciate it.

#include<stdio.h>
#include<stdlib.h>

void whatIs (int nNum)
{
int nF = 2;
while (nNum % nF != 0)
nF++;
if (nNum != nF)
{
printf("%d ", nF);

whatIs (nNum/nF);
}
else
printf("%d.", nF);
}

int main()
{
    int nNum;
    scanf("%d",&nNum);
    whatIs(nNum);
    system("pause");
}

No, this something you can easily do yourself, and just involves a bit of problem solving. You NEED to develop your problem solving, or you can't program worth a darn.

Work through it by hand, and see what kind of loops you're using!

Put some sweat into it! ;) Don't look at the recursive code - don't look at any code, right now. Learn how YOU would solve for LCD, using a loop (which is very natural, btw)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.