Login to ask a question from C programs on various integers

C Program to find prime numbers in a given range

Upon execution of below program, the user would be asked to provide the from & to range and then the program would display all the prime numbers in sequential manner for the provided range. Using this program you can find out the prime numbers between 1 to 100, 100 to 999 etc. You just need to input the range, for e.g. if you want the prime numbers from 100 to 999 then enter numbers 100 and 999 when program prompts for input.


Source code:

#include

int main()

{

   int num1, num2, flag_var, i, j;

 

   /* Ask user to input the from/to range

    * like 1 to 100, 10 to 1000 etc.

    */

   printf("Enter two range(input integer numbers only):");

   //Store the range in variables using scanf

   scanf("%d %d", &num1, &num2);

Â....

Show More
Previous Question Next Question
🔗

Similar Questions

From C programs on various integers · C programming

View All
WhatsApp