Examples of C part 34 prime number between 2 numbers
Program:
Output:
Explanation:
//Coming Soon..
#include<stdio.h> main() { int num1,num2,i,count=0,j; printf("Enter a number 1\n"); scanf("%d",&num1); printf("Enter a number 2\n"); scanf("%d",&num2); printf("The Prime numbers between %d and %d are\n",num1,num2); for(i=num1;i<=num2;i++) { count=0; for(j=1;j<=i;j++) { if(i%j==0) { count++; } } if(count==2) { printf("%d\n",i); } } }
Enter a number 1 2000 Enter a number 2 2100 The Prime numbers between 2000 and 2100 are 2003 2011 2017 2027 2029 2039 2053 2063 2069 2081 2083 2087 2089 2099
Explanation:
//Coming Soon..