a c program to computes the prime numbers in the user mentioned range
#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):");
//Store the range in variables using scanf
scanf("%d %d", &num1, &num2);
//Display prime numbers for input range
printf("Prime numbers from %d and %d are:\n", num1, num2);
for(i=num1+1; i<num2; ++i)
{
flag_var=0;
for(j=2; j<=i/2; ++j)
{
if(i%j==0)
{
flag_var=1;
break;
}
}
if(flag_var==0)
printf("%d\n",i);
}
return 0;
}
Also in C:
- terminal size in c
- insert image material ui
- how to create random integers from a specific range in c language
- factorial c program using for loop
- get the latest field in mongodb collection
- python 3.9 install pip cv2
- eeprom read arduinojson object
- update os ubuntu terminal
- print hello world in c
- c print hello world
- actionbar content color in android
- markdown empty line
- diamond dataset in r
- typedef vs #define
- first person view unity
- even odd c
- arduino keypad wait for key
- logging.logger
- matplotlib legend remove box
- c get first n characters of string
- global and local variables in c
- lognormal distribution - matlab
- latex noindent
- read file in C