Let the number entered by the user is 13 ,i.e., n=13

**for(i=2; i<=n/2; i++) ** /* for loop is executed till i is equal to n/2 */

**for(i=2; i<=13/2; i++) ** /* for loop is executed till i is equal to 6 */

**1st Iteration: for(i=2; i<=6; i++) **

(13 % 2) is not equal to 0

value of flag=0

for loop will continue

i is incremented to 3 ,i.e., i=3

**2nd Iteration: for(i=3; i<=6; i++) **

(13 % 3) is not equal to 0

value of flag=0

for loop will continue

i is incremented to 4 ,i.e., i=4

**3rd Iteration: for(i=4; i<=6; i++) **

(13 % 4) is not equal to 0

value of flag=0

for loop will continue

i is incremented to 5 ,i.e., i=5

**3rd Iteration: for(i=5; i<=6; i++) **

(13 % 5) is not equal to 0

value of flag=0

for loop will continue

i is incremented to 6 ,i.e., i=6

**4th Iteration: for(i=6; i<=6; i++) **

(13 % 6) is not equal to 0

value of flag=0

for loop will continue

i is incremented to 7 ,i.e., i=7

**5th Iteration: for(i=7; i<=6; i++) **

for loop will terminate as i>6

As the value of flag=0 so 13 is a prime number