# loops (Iteration ) in C (Part 2)

**Example :- Program to check whether a input number is prime or not.**

Prime number is a number which is divisible by only 1 and itself. So here we take a loop which will execute from 2 to (n-1) . if the number is divisible by any number in this range then it is not a prime number. and if not divisible by any number then loop will fully executed and loop variable will be equal to that number (i.e i=n) and in this condition number is a prime number.

**Output:-**

Know more about break and continue :- Click here

__Nested loop:-__

Whenever a looping construct written inside the body of another looping construct then this is called nesting of loop. Here the loop which is written inside is called the inner loop and the loop in which it is written is called outer loop .In other words we can say that inner loop is nested inside outer loop.

**Example:-**

Explanation:- For i=0 inner loop will execute for j=0 and 1 and again for i=1 inner loop will execute for j=0 and 1. so output is

**Practice set of loop (Question for practice ) :-** Click here

<<Pre – Loops in C part-1 Next – Break and Continue in C>>

__Recommended Post:__

__Hackerearth Problems:-__

- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem

__Hackerrank Problems:-____Data structure:-__

- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree

__Key points:-__

- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier

__Must check this:-__

__ MCQs:-__