Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  piyu
Language: C/C++
Code:
#include<stdio.h>
#include<conio.h>
int main() 
{
     
 int j,n,i,flag=0;
 int r=1;
 int sum=0;
 printf("enter the no:");
 scanf("%d",&n);
 for(i=2;i<=n;i++)
 {
   flag=0;
   for(j=2;j<=i/2;j++)
    {
      if(i%j==0)
      flag=1;
     }               
    if(flag==0)
    {
      for(i=n;i>=1;i--)
      r=r*i;
      sum=sum+r;
      r=1;
     }
  }
  printf("the sum is:%d", sum);
  getch();
  return (0);
}
Comments: