#include<stdio.h>intcheck_prime(int num);intmain(){int n1,n2,i,flag;printf("Enter two numbers(intervals): ");scanf("%d %d",&n1,&n2);printf("Prime numbers between %d and %d are: ", n1, n2);for(i=n1+1;i<n2;++i){
flag=check_prime(i);if(flag==0)printf("%d ",i);}return0;}intcheck_prime(int num)/* User-defined function to check prime number*/{int j,flag=0;for(j=2;j<=num/2;++j){if(num%j==0){
flag=1;break;}}return flag;}
Output:
Enter two numbers(intervals): 100
500
Prime numbers between 100 and 500 are: 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499
need an explanation for this answer? contact us directly to get an explanation for this answer