♠ Posted by Unknown in C'Language at 00:05
Pre-Tested [Entry Controlled] Loops :
while Loop:
The simplest of all the looping structure
in c' is the while statement. The basic format of the while statement is :
Syntax:
while (condition)
{
body of loop
}
The while is an "entry controlled
loop" statement. The test condition
is evaluated and if the condition is True, then the body of the loop is
executed. After execution of the body, the test condition is once again
evaluated and if it is true, the body is
executed once again. This process of repeated until the test condition finally
becomes false and the control is transferred out of the loop. On exit, the
program continues with the statement immediately after the body of the loop.
The body of the loop may have one or more
statements. The braces are needed only if the body contains two or more
statements. However it is a good practice to use braces even if the body has
only statement.
Example :-
void main()
{
int a;
a=1;
while (a<=10)
{
printf(" % d \n ", a);
a=a+1;
}
getch();
}
for Loop:
The for loop is another entry-controlled loop that provides a more loop control structure. The general form of the for loop is.
Syntax:-
for(initialization; test-condition;
increment)
{
body
of the loop;
}
The executed of the for loop statement is
as follows:
1. Initialization
of the control variables is done first, using assignment statements such as i=1
and count=0. The variable i and count are known as loop control variables.
2. The
value of the control variable is tested using the test-condition. The test
condition is a relational expression, such as i<10 that determines when the
loop will exit if the condition is executed, otherwise the loop is execution
continues with the statement that immediately follows loop.
3. When
the loop is executed, the control is transferred back to the for statement
after evaluating the last statement in the loop. Now, the control variable is
incremented using an assignment statement such as i=i+1 and the new value of
the control variable is again tested to see whether is satisfied the loop
condition.
Example:-
main ()
{
int a;
for
(a=1; a<=10, a+1);
{
printf(" %d\n " , a);
}
return;
}
4 comments:
for is it pre-test i think
Well Done Articles,Thanks for Sharing with us
python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery
no deposit bonus forex 2021 - takipçi satın al - takipçi satın al - takipçi satın al - takipcialdim.com/tiktok-takipci-satin-al/ - instagram beğeni satın al - instagram beğeni satın al - google haritalara yer ekleme - btcturk - tiktok izlenme satın al - sms onay - youtube izlenme satın al - google haritalara yer ekleme - no deposit bonus forex 2021 - tiktok jeton hilesi - tiktok beğeni satın al - binance - takipçi satın al - uc satın al - finanspedia.com - sms onay - sms onay - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - perde modelleri - instagram takipçi satın al - instagram takipçi satın al - cami avizesi - marsbahis
Thank you for sharing your awesome and valuable article this is the best blog for the students they can also learn.
https://lookobeauty.com/best-interior-designer-in-gurgaon/
Post a Comment