Khalid's Letter
Khalid’s Letter is a blog based on personal perception. The content you find here will help you to expand your own knowledge of different perspective, improve your thinking skills, and inspire your creativity to get your work done into the world. This isn’t just about blog; it’s the concept that will keep you top in every place!
Sunday, June 18, 2023
Sunday, January 22, 2023
Loops in C Programming Language
What is loop?
In computer programming, a loop is a sequence of
instructions that is continuously repeat until a certain condition is
reached.
There are two types of loops in C Programming:
Entry Controlled loops: In Entry controlled loops the test condition is checked before entering the main body of the loop. For Loop and While Loop is Entry-controlled loops.
Exit Controlled loops: In Exit controlled loops the test condition is evaluated at the end of the loop body. The loop body will execute at least once, irrespective of whether the condition is true or false. do-while Loop is Exit Controlled loop.
For Loop
for loop in C programming is a repetition control
structure that allows programmers to write a loop that will be executed a
specific number of times. for loop enables programmers to perform n number of
steps together in a single line.
Syntax:
{
//
// body of for loop
//
}
#include <stdio.h>
int main()
{
int i = 0;
for (i = 1; i
<= 10; i++)
{
printf(
"Hello ICSK\n");
}
return 0;
While Loop
do-while Loop