Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by Prime Number Check Positi ( 13 years ago )
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int i=2,n=2,a=0,k,total;
    printf("Enter The Position of Prime Number that you want to know :");
    scanf("%d",&k);

    do{
        if(i<=n)
        {
            if(n%i==0)
            {
                if(i==n)
                {
                    total=i;
                    a++;
                    if(a==k)
                    {
                        printf("%d is Prime Number of position %d",total,k);
                    }
                    else
                    {
                        i=2;
                        n++;
                    }
                }
                else
                {
                    i=2;
                    n++;
                }
            }
            else
            {
                i++;
            }
        }
        else
        {
            i++;
        }
    }
    while(a!=k);
}

 

Revise this Paste

Parent: 60734
Your Name: Code Language: