05 Instrctrl en
05 Instrctrl en
Control Structures
ESTiG
2 Control Structures
3 Examples
Summary
2 Control Structures
3 Examples
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
int age = 40 ;
double height = 1.72 ;
char gender = 'M ';
printf (" Profile : % d years , % f meters , gender = % c\n " , age , height , gender ) ;
Summary
2 Control Structures
3 Examples
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Control Structures
There are several phases on the implementation of a program, namely:
1 Finding the program's requirements Specication
2 Research and analysis of the possible solutions
3 Coding and debugging (development loop)
Phase 2 can consist of the program's representation in the form of a
ux diagram (≡ algorithm)
This ux diagram is later implemented (phase 3) by using C code
C language sequential programming paradigm
Provides a group of control structures, allowing the programmer to
control the ow of execution:
Selection structures - if, switch/case
Loop structures - while, do/while, for
Aiming to ease application design/algorithm, we introduce the basic
concepts behind select and loop structures
[email protected] (ESTiG) Imperative programming 8 / 14
Control Structures
Summary
2 Control Structures
3 Examples
Examples
Age verication:
# include < stdio .h >
int main () {
int age = 40 ;
if ( age >= 18) {
printf (" You can vote !\ n") ;
}
}
int main () {
int number = 0, sum = 0 ;
while ( number < 100) {
number = number + 2;
sum = sum + number ;
}
printf (" Even sum = %d\ n" , sum );
}
Examples
Age verication:
# include < stdio .h >
int main () {
int age = 40 ;
if ( age >= 18) {
printf (" You can vote !\ n") ;
}
}
int main () {
int number = 0, sum = 0 ;
while ( number < 100) {
number = number + 2;
sum = sum + number ;
}
printf (" Even sum = %d\ n" , sum );
}
Examples
int main () {
int number = 0, sum = 0 ;
do {
number = number + 2;
sum = sum + number ;
} while ( number < 100) ;
printf (" Even sum = %d\ n" , sum );
}
Looking at this simple example, while and do/while have the same
exact eect
Along the way, we will learn that more complex scenarios can be more
appropriate to while or do/while
Examples
int main () {
int number = 0, sum = 0 ;
do {
number = number + 2;
sum = sum + number ;
} while ( number < 100) ;
printf (" Even sum = %d\ n" , sum );
}
Looking at this simple example, while and do/while have the same
exact eect
Along the way, we will learn that more complex scenarios can be more
appropriate to while or do/while
Examples
int main () {
int number = 0, sum = 0 ;
do {
number = number + 2;
sum = sum + number ;
} while ( number < 100) ;
printf (" Even sum = %d\ n" , sum );
}
Looking at this simple example, while and do/while have the same
exact eect
Along the way, we will learn that more complex scenarios can be more
appropriate to while or do/while