answersLogoWhite

0

i ll give you the logic and if u know a lil bit of c u can make it..

accept the two no's from user==> use scanf

if the 1st no is 2

print that using printf like>>1st no is prime

then put a nested for loop

i.e. for (int i = 1st no ;i <=2nd no; i ++)

{ for (int j= 2 ; j <i; j++)

now check for condition

if i/j==0 then printf not prime

else printf prime

so its over u see.....

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Write a c program to find out the prime numbers between 1 to 500?

To write a C program to find prime numbers between 1 to 500, you can use a nested loop structure. In the outer loop, iterate from 2 to 500, and in the inner loop, check if the number is divisible by any number from 2 to the square root of the number. If it is not divisible by any number other than 1 and itself, then it is a prime number. Print out all prime numbers found within the specified range. Remember to include necessary header files, such as &lt;stdio.h&gt;, and use appropriate logic to implement the program efficiently.


What BASIC program can compute and display all prime numbers from 1 to 40?

PRINT 2,3,5,7,11,13,17,19,23,29,31,37


C program to find prime number?

I am providing a succinct and easy to understand version of the program. I have run it in 3-4 compilers and it works perfect. Mind you, you should not enter a number more than 2147483647 (which is the largest number a variable can process in C!). If you do, no problem, but it will display all numbers above it, including the even numbers to be prime. So here you are:#include#includemain(){long int a,b,c;printf("Enter the number: ");scanf("%ld",&a);for (b=2;b


Write a c program to generate all prime numbers in the given range?

look man that would take alot &gt;&gt;&gt; Ill give you the way =============================================================================== this answer i write it now on net ! i read about that befor in it uni where i study i will chick out the answer and re write it best wishes 2024


How do you print non-prime numbers in java?

Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.

Related Questions

How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


What are the prime factors between 20 and 30?

Prime numbers between the given numbers are 23 and 29


How many prime numbers between 1 and 8888888888888888888888888888888888888888888888?

To determine the number of prime numbers between 1 and 8888888888888888888888888888888888888888888888, we can use the Prime Number Theorem. This theorem states that the density of prime numbers around a large number n is approximately 1/ln(n). Therefore, the number of prime numbers between 1 and 8888888888888888888888888888888888888888888888 can be estimated by dividing ln(8888888888888888888888888888888888888888888888) by ln(2), which gives approximately 1.33 x 10^27 prime numbers.


Prime numbers between 1 to 10 in microprocessor 8085?

program to find prime number in 8085 microprocessor


When did Eratosthenes find prime numbers?

Eratosthenes lived between 276 and 194 B.C. He didn't discover prime numbers; he devised a simple way to determine what numbers are prime in a given range.


Rational numbers between 3 and 5?

There are infinitely many of them.Some of them are given by:All numbers of the form 3n+1/n for n &acirc;&circ;&circ; the prime numbers are rational numbers between 3 & 4, and as there are an infinite number of prime numbers, there are an infinite number of these.All numbers of the form 4n+1/n for n &acirc;&circ;&circ; the prime numbers are rational numbers between 4 & 5, and as there are an infinite number of prime numbers, there are an infinite number of these.There are still more than the infinitely many given above.


What is the product of the prime numbers between 29 and 30?

29 is a prime number. There are no prime numbers between 29 and 30.


Are 83 43 and 61 prime?

The given three numbers are all prime numbers


Are there less prime numbers between 101 and 200 than between 1 and 100?

NO. There are more prime numbers between 1 and 100 than the prime numbers between 101 and 200.number of prime numbers between 1 and 100 = 25number of prime numbers between 101 and 200 = 20


What is the difference between factors of a number and prime factors of a number?

All numbers have factors. Some factors are prime numbers. These are known as prime factors. The set of prime factors is a subset of the set of factors for any given number.


Which of the prime numbers 2 3 4 5 6 and 7 cannot be the difference between two consecutive prime numbers greater than 2?

Any prime numbers greater than 2 will be odd numbers. The difference between two odd numbers will be an even number. So, the difference between two prime (and odd) numbers could be 2, 4, or 6, of the numbers given. The difference could not be 3, 5, or 7.


Are there prime numbers between 114 and126?

There are no prime numbers between 114 and 126.