1 Attachment(s)
programme, prime factorisation
Hey! I'm a complete beginner and I want to write a programme which does the prime factorisation of numbers. The numbers are in a file. The prime factorization should be in a new file. I have written everything and the programme successfully debugged but the window opened and closed. I don't know what's wrong with it.
This is a part of my code
Code:
{
int number_ofnumbers=0;
char c;
fscanf(f,"%c", &c);
if (c=='\0')
number_ofnumbers++;
int a[number_ofnumbers];
int i;
for (i=0; i<number_ofnumbers; i++)
{
int j;
int k=0;
int b[100];
if (a[i]>1)
{
for(j=2; j<=sqrt(a[i]); j++)
while ((a[i]% j) == 0)
{
if (sqrt(a[i]) != j)
{
k++;
b[k] = a[i];
}
else
{
k++;
b[k] = j;
}
}
Could anyone look whether it's ok or not? I'd be very thankful.