Write C program to find sum of prime numbers between 1 to n in c programming-99webcode

Write C program to find sum of prime numbers between 1 to n in c programming-99webcode


Write C program to find sum of prime numbers between 1 to n in c programming-99webcode



#include<stdio.h>

int main()

{

int i ,n ,sum=0;

printf("enter the number\n");

scanf("%d",&n);

for(i=0; i<=n;  i++)

{   

if (i%2==0)

{

  sum=sum+i;

}

}

printf("sum of all prime number between entered number is :%d\n",sum);


output:

enter the number                                                                                                 

10

sum of all prime number is between entered number is :30  

Post a Comment (0)
Previous Post Next Post