Chapter:

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 <stdio.h>

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):");

  ....

Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-