Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int isprime(num){
- int j, flag;
- flag = 0;
- if (num <= 1){
- return 0;
- }
- for (j = 2; j <= num / 2; j++){
- if ((num % j) == 0){
- flag = 1;
- break;
- }
- }
- if(flag == 0){
- return 1;
- }else{
- return 0;
- }
- }
- int main(){
- int num1, num2, i;
- printf("Enter two number");
- scanf("%d", &num1);
- scanf("%d", &num2);
- for (num1; num1<=num2; num1++){
- if(isprime(num1) == 1){
- printf(" %d ", num1);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment