0% found this document useful (0 votes)
22 views

Reporte - Project 1 Programming

The document discusses control structures and logical operators used in an embedded systems programming project. It includes an introduction describing the elements and structures used, including for loops, do-while loops, if/else statements, and nested structures. It provides code examples with comments for two exercises using these structures and logical operators like ++, OR, and %. A table defines common logical operators and their functions. The conclusion states that understanding control structures and logical operators allows solving problems and making more specific decisions to better control programs.

Uploaded by

Andrick Mendez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Reporte - Project 1 Programming

The document discusses control structures and logical operators used in an embedded systems programming project. It includes an introduction describing the elements and structures used, including for loops, do-while loops, if/else statements, and nested structures. It provides code examples with comments for two exercises using these structures and logical operators like ++, OR, and %. A table defines common logical operators and their functions. The conclusion states that understanding control structures and logical operators allows solving problems and making more specific decisions to better control programs.

Uploaded by

Andrick Mendez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1

Universidad Politécnica de Yucatán

Computational Embedded Systems

Engineering Programming

Project 1 Unit 1

Professor:

Angel Arturo Pech Che

Student:
Manuel Arturo Ruz Azcorra

18/05/2023 Embedded 1-A


2

Index

Cover page.....................................................................................................1
Index..............................................................................................................2
Introduction...................................................................................................3
Struture control..............................................................................................3
Evidence........................................................................................................3
Logic operators..............................................................................................4
Conclusion.....................................................................................................4
3

Introduction

In the following report I will explain the elements used in the project, as well as the
control structure used (if, do while, nested structure and for), the codes made for each
exercise and the table of logical operators used such as ++, OR, % among others, with
their respective function.

Structure Control
The control structures used were for, do while, if, and nested to construct the codes
of the project.
For: The for loop is a control structure that allows a condition to be executed a certain
number of times. It consists of three parts: an initialization statement, a condition, and
an update statement. The loop ends when the condition is met.
Do while: Is a loop that executes at least once and then continues to execute as long as
the specified condition is met. unlike while, it first performs the action and then
checks it.
If: Is a condition that allows to fulfill a function if it is correct if it is not, the else can
be used to execute the opposite of the original function (depending on what is
required).
Nested: Nested control structures are structures that imply other structures within
themselves in order to generate more complex and specific decisions.

Codes with commentaries


Excersice 1.-
#include
<stdio.h> int
main() {
int number, i;

do{
printf("Enter a number between 1 to 10. \
n"); scanf("%d", &number);
} while (number<1 || number >10); //con el do while comprobamos si
el numero realmente es del 1 al 10//
if (number>=1 || number <=10){ //|| se refiere a la operacion
OR la cual indica si es un u otro ejemplo: 5>4|| 3>3 = 1 ó verdadero
for(i=1; i<= number; i++)
{ printf( "%d ", i
);}
if(number%2==0) // para comprobar si es par el numero ingresado//

printf("Its a even number. \n");


else(printf("Its a odd number. \n"));
}else printf("Invalid number. \

n"); return 0;
4

Excersice 2.-
#include
Logic Operators
<stdio.h> int
Operator
main() { Function
= int num; equal
< printf("Introduce a positive number:Less than
> "); scanf("%d", &num); Greater than
<= Less than or equal to
if (num > 0) {// primera condicion para la estructura
>= Greater than or equal to
anidada// if (num % 2 == 0)
++ Increment
printf("The number is positive and even.\
% n"); else
Rest of
|| OR and odd.\n");
printf("The number is positive
} else if (num < 0) {// si no se cumple la primera condicion
evalua los numeros pares e impares//
Conclusion if (num % 2 == 0)
printf("The number is negative and even.\n");
By analyzing and describing various control structures such as conditionals and loops,
else //cumple la funcion de un sino, ejecuta la otra
as well as the use of logical operators, we can solve problems using these programming
funcion// printf("The number is negative an odd.\n");
tools. The understanding of these control structures allows us to make decisions for
}
more specific conditions which allows us to maintain better control of the program by
adapting to each specific situation. In summary, we can generate a better program
using return
logical operators
0; and control structures for the code.

You might also like