a c program to computes the prime numbers in the user mentioned range

Solutions on MaxInterview for a c program to computes the prime numbers in the user mentioned range by the best coders in the world

showing results for - "a c program to computes the prime numbers in the user mentioned range"
Malena
20 May 2018
1#include <stdio.h>
2int main()
3{
4   int num1, num2, flag_var, i, j;
5 
6   /* Ask user to input the from/to range
7    * like 1 to 100, 10 to 1000 etc.
8    */
9   printf("Enter two range(input integer numbers only):");
10   //Store the range in variables using scanf
11   scanf("%d %d", &num1, &num2);
12 
13   //Display prime numbers for input range
14   printf("Prime numbers from %d and %d are:\n", num1, num2);
15   for(i=num1+1; i<num2; ++i)
16   {
17      flag_var=0;
18      for(j=2; j<=i/2; ++j)
19      {
20         if(i%j==0)
21         {
22            flag_var=1;
23            break;
24         }
25      }
26      if(flag_var==0)
27         printf("%d\n",i);
28  }
29  return 0;
30}
queries leading to this page
range of prime number program in cprint all prime numbers in a given range in cprime no in range program in cprime numbers in a range in cc program to display the prime numbers in a given rangeprint co prime numbers in range in cc program to print prime numbers between given rangec program to find prime number between 1 and 100print all the prime numbers in a given range in cprintf all super primes in rangeprint prime numbers from given range in cc code to print prime numbers within a rangeprime number in given range in cc program to print prime numbers between in agiven rangewrite down a c program to find all the prime numbers in a given range 28upper and lower range should be given from the keyboard 29 prime numbers in a given range in chow many prime numbers are before a number in c 2b 2bc program to find prime numbers between given range using functionsprime numbers range in cc program to print prime numbers in a given range using function output will be no of ansall prime number in given range cdisplay prime numbers within a range in c using functionc program to find prime number between a range of numberprime number in a range in c efficientc program to print co prime number between rangeprint prime number in given rangec program to find all the prime numbers in given rangeprogram to find prime number in a range cprime number range program in cprime number program in c in given rangeprime range code in cprogram to find prime numbers in a given range in cprime numbers upto range programwrite a c program to find all prime number between user given rangeprime numbers in a range cprime number in a given range in cchecking prime numbers in c in a rangewrite a program in c to find the prime numbers within a range of numbers program to find prime number in a range cprint prime numbers in a given range in cc program to print prime numbers in a given range using functionprime numbers in given range in cfind prime rangers between two numbersfind prime numbers in a given range cwrite a c program to print the prime numbers in the given rangewrite a program to display prime numbers between 1 and 100 using functions in csegregate prime and composite numbers in cprogram to find the prime numbers between a given range in cprime numbers of range in cc program to count prime numbers in a given range using functionprime numbers in the given range in ca c program to computes the prime numbers in the user mentioned range