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: ,

Related Posts:

  • Check_CHAR(alpha,num) /* program to check given character is alphabet, digit or any other character */ #include<iostream.h>#include<conio.h> int main(){    char a;    cout <<"Ente… Read More
  • Pattern_pyramid /* program to print the following pattern....         &       &   &     &       &  … Read More
  • Switch_AREA /*  Program to compute area of square, rectangle and circle.... */ #include<stdio.h>int main(){int a;float l,b;printf("\n******MENU*****");printf("\n1.Square \n2.Rectangle \n3.Circle\n");scanf("%d",&a);swi… Read More
  • ugly_number /*program to generate nth ugly number Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ... shows the first 11 ugly numbers. By convention, 1 is includ… Read More
  • Pattern_nested LOOP /* program to generate following pattern......     *    ***   *****  ******* *********  */ #include<iostream.h>#include<conio.h>  void main(){clrscr(); … Read More

0 comments:

Post a Comment

Copyright © 2025 UPgradeCODING | Powered by Blogger