Professional Documents
Culture Documents
management and
technology,anita.
Sub:- Computer programming and utilization
Name:-
Enrollment no:-
Patel Foram
140940107030
Kumbhani Nidhi
140940107020
5-1
Content
5-2
Repetition Statements
Repetition statements allow us to execute a
statement multiple times
5-3
5-4
condition
evaluated
true
false
statement
5-5
5-6
Output:-
#include<conio.h>
Void main()
sum=15
scanf(%d,&n);
while(i<=n)
{printf(enter the value of n\n);
scanf(%d,&a);
sum+=a;
i+=1
}
Printf( sum=%d,sum\n);
}
2004 Pearson Addison-Wesley. All rights reserved
5-7
5-8
statement
true
condition
evaluated
false
5-9
#include<conio.h>
Output:-
Void main()
xnum=num;
do
{ temp=xnum%10;
rev=(rev*10)+temp;
xnum=xnum/10;}
while(xnum!=0);
printf(reverse of the number%d is %d,num,rev);
}
2004 Pearson Addison-Wesley. All rights reserved
5-10
The do Loop
statement
condition
evaluated
true
statement
true
false
condition
evaluated
false
5-11
The statement is
executed until the
condition becomes false
5-12
false
statement
increment
5-13
5-14
5-15
5-16
5-17