## Write a program that determines the sequence of Prime Numbers within the range input by user.

Upon execution of below program, the user could be asked to offer the from & to variety after which this system would show all of the high numbers in sequential manner for the furnished variety. The usage of this application you can discover the top numbers between 1 to one hundred, one hundred to 999 etc. You just want to input the range, for e.G. In case you need the high numbers from one hundred to 999 then enter numbers 100 and 999 when application activates for enter.

###

What is Prime Number?

A high number is an entire range extra than 1, whose handiest whole-quantity elements are 1 and itself. The first few top numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.

So we can said that,

A prime number can be divided evenly handiest through 1, or itself.

And it need to be an entire wide variety extra than 1.

Example: 5 can only be
divided evenly by 1 or 5, so it is a prime number.

But 6 can be divided evenly by 1, 2, 3 and 6 so it is NOT a prime number (it is a composite number)

But 6 can be divided evenly by 1, 2, 3 and 6 so it is NOT a prime number (it is a composite number)

## Code:

#include<stdio.h>

#include<conio.h>

void main()

{

int n,count,j;

int a=1;

printf("Enter The Value To Print Prime Number between 1 and ");

scanf("%d",&n);

printf("Prime Numbers Upto %d \n\n",n);

while(a<=n)

{

count=0;

for(j=1;j<=a;j++)

{

if(a%j==0)

count++;

}

if(count==2)

printf("%d ",a);

a++;

}

getch();

clrscr();

}

### Output:

*Try it yourself.*

*If you have any problem you can tell me on comment box i will help you.*

*thanks.*
write a program that calculate the sum of first n odd integers using loops

ReplyDeletepls is ka answer chiay

ReplyDeletepls is ka answer chiay

ReplyDeletewrite a program that calculate the sum of first n odd integers using loops

ReplyDeleteRaima is link ko open karo ap k Question ka solutuion mil jay ga.

ReplyDeletehttps://goo.gl/DmMcDZ