Computer Science, asked by shashikant884, 10 months ago

wap to display prime numbers up to a certain limit.

Answers

Answered by Anonymous
1

A program to display prime numbers up to a certain limit:

  • #include<stdio.h>

        int main()

        {

        int i, pri, upp, low,n;

        printf("enter the lower limit");

        scanf("%d", &low);

        printf("enter the upper limit");

        scanf("%d", &upp);

        printf("Prime Numbbers list is:");

        for(n=low+1;n<upp;n++)

        {

         pri=1;

         for(i=n/2;i<n/2;i++)

           if(n%i==0)

            {

              prime=0;

               break;

             }

            if(prime)

              printf("%d",n);

           }

  • Input: low=1, upp=10

         output: 2,3,5,7

         input: low=10, upp=20

         output: 11,13,17,19.

Answered by BeautifulWitch
2

Answer:

print("Prime Numbers")

print("Instructions")

print("1. Enter all values as numbers .")

print("These are your prime nummbers .")

lower = int(input("Enter lower range: "))

upper = int(input("Enter upper range: "))

for num in range(lower,upper + 1):

if num > 1:

for i in range(2,num):

if (num % i) == 0:

break

else:

print(num,'is a prime number .')

print("END")

Explanation:

Hope this helps you ✌️

Attachments:
Similar questions