Prime Number:
A positive number whose divisors only 1 and the number itself (among all the positive numbers) are known as prime number.
Example: 1,2,3,5,7,11.
Among positive even number only 2 is the prime number rest of all the prime numbers are odd(positive) number.
#include<stdio.h> int main() { int number,i,j,primeNumber,low=1,high=100,sum=0; printf(" Sum of Prime Numbers : \n"); for(j=low;j<=high;j++){ primeNumber=0; for(i=2;i<=j/2;i++){ if(j%i==0){ primeNumber++; break; } } if(primeNumber==0 && j !=1) sum +=j; } printf("%d\t ",sum); return 0; }
output:
Sum of Prime Numbers :
1060