Search & Find out

Thursday, December 3, 2009

Sum of prime numbers

#include "stdio.h"
#include "conio.h"
void main ()
{
    int i,n,R,m;
    clrscr ();

    printf("Enter a no. to find out all Prime no.: ");
    scanf("%d",&m);

    for (n=1;n<=m;n++)
    {
        for (R=2;R
        {
            if (n%R==0)
            {
                break;
            }
        }
        if (R==n)
        {
            printf ("%d\t",n);
        }
    }
getch ();
}



Download the executable (.exe)  file for this program..
download

0 comments:

Post a Comment

 

My Blog List

Term of Use