# C program to find the Sum of Prime numbers between a Range

## Program to find the Sum of Prime numbers between a Range

Prime number is an Integer number. The Prime number can be divisable by 1 and the number itself. If a number has more positive divisors other than 1 and the number itself, then the number is not Prime number. For example: 2, 3, 5, 7, 11, 13, 17  . . . are Prime numbers. The below given C program to find the Sum of Prime numbers between a Range. Kindly check out the program to find the Sum of prime numbers between a Range.

### Program to find Sum of prime numbers between Range

#include<stdio.h>

int main(){

int numbr,k,remark,first,last,sum=0;

printf("Give the First Number for the Range : ");
scanf("%d",&first);
printf("\n Give the Last Number for the Range : ");
scanf("%d",&last);

for(numbr= first; numbr<= last; ++numbr)

{

remark=0;

for(k=2; k<=numbr/2; k++)

{

if((numbr % k) == 0){

remark++;

break;

}

}

if(remark==0)

sum += numbr;

}

printf("\n   Sum of prime numbers is:  %d ",sum);

return 0;

}

Sample output:

Give the First Number for the Range :  20

Give the Last Number for the Range  :  100

Sum of prime numbers is:  983