8 Mar 2013

grapline level-2 solved


/*
 solution to grapline online change level-2

*\



#include<stdio.h>
#include<conio.h>
int checkprime(int );
void main()
{long int n=514230,i,sum=0;
for(i=2;i<n-1;i++)
    {if(checkprime(i)!=0 && n%i==0)
        {printf("\n%ld",i);
            {sum=sum+i;}
        }
    }
printf("OUTPUT:%ld",sum);
getch();
}

int checkprime(int i)
{for(int j=2;j<i;j++)
    {if(i%j==0)
        {return 0;}
    }
if(i==j)
return 1;
}

Categories: ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger