Computer Science, asked by wwwfatimabivi2001, 11 months ago

writa a program to find all the prime number with a given range ?​

Answers

Answered by queensp73
1

Answer:

#include<stdio.h>

int main()

{

  int i, prime,upper,lower, n;

  printf(" ENTER THE LOWER LIMIT : ");

  scanf("%d", &lower);

  printf("\n ENTER THE UPPER LIMIT : ");

  scanf("%d", &upper);

  printf("\n PRIME NUMBERS LIST IS : ");

  for(n=lower+1; n<upper; n++)

  {

    prime = 1;

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

      if(n%i == 0)

      {

        prime = 0;

        break;

      }

    if(prime)

      printf("\t%d", n);

  }

}

 

OUTPUT:

ENTER THE LOWER LIMIT : 10

ENTER THE UPPER LIMIT : 100

PRIME NUMBERS LIST IS :        11      13      17      19      23      29

31      37      41      43      47      53      59      61      67      71

73      79      83      89      97

This Program Reduces the number of iterations in the for loop.

Explanation:

HOPE THIS HELPS U MY FRD !

PLZ MARK AS BRAINLIEST !

>>>>>>THANK U<<<<<<

#keep smiling :)

Similar questions