-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasal.cpp
More file actions
38 lines (29 loc) · 665 Bytes
/
asal.cpp
File metadata and controls
38 lines (29 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<stdio.h>
#include<stdlib.h>
int main()
{
int low, high, i, flag,j=0,k;
printf("Enter two numbers(intervals): ");
scanf("%d %d", &low, &high);
printf("Prime numbers between %d and %d are: ", low, high);
k=low;
while (low < high)
{
flag = 0;
for(i = 2; i <= low/2; ++i)
{
if(low % i == 0)
{
flag = 1;
break;
}
}
if (flag == 0){
printf("%d ", low);
j++;
}
++low;
}
printf("\n%d ile %d sayilarinin arasindaki asal sayilarin sayisi: %d ", k,high,j);
return 0;
}