Description:
Prime
number is a number which is exactly divisible by one and itself only
Ex:
2, 3,5,7,………;
Algorithm:
Step
1: start Step 2: read n
Step
3: initialize i=1,c=0
Step
4:if i<=n goto step 5 If not goto step 10
Step 5: initialize j=1
Step
6: if j<=1 do as the follow. If no goto step 7
i)if i%j==0 increment
c
ii)
increment
j
iii) goto
Step 6
Step 7: if c== 2 print i
Step 8: increment i
Step 9: goto step 4
Step 10: stop
No comments:
Post a Comment