Help me to find the largest prime factor of an integer.

aniknaruto's Avatar, Join Date: Jan 2010
Newbie Member
My program didn't work . I couldn't find any mistake . When i compiled it , it showed error in 17 line .What should i do ?
Here is my code :
Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{long int a,b,c,d,e,f;   
d=1; 
scanf("%ld",&a);
for(e=a;e>=1;e--)
{f=a%e;
if(f==0)
{
for(b=1;b<=sqrt(e);b++)
{c=e%b;

if(c==0)
{d=d+1;
 
      }
       }
if(d==2)
{
goto AA;}
}

        } 
        }  

AA:
print("%ld",e);        
system("pause");  
      }

Last edited by shabbir; 1Feb2010 at 09:43.. Reason: Code blocks
aniknaruto's Avatar, Join Date: Jan 2010
Newbie Member
The compiler showed error in 17th line . I used dev-c++ 4.9.9.2 .
Gene Poole's Avatar, Join Date: Nov 2009
Contributor
My mind reading skills are a bit off today. Would you be so kind as to tell us what the compiler error was?

Please format your code for readability and post it using code tags. Type:

[code]

int main()
{
return 0;
}
[/code]

to give this:
Code:
  int main()
  {
    return 0;
  }
At a quick glance, it seems that there are more '}' than '{' characters.
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Also please explain your alrogithm and what the variables are for. Using single letter variable names makes the code completely unreadable.