Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

C language

Puntuación
-
Vendido
1
Páginas
84
Grado
A+
Subido en
22-03-2023
Escrito en
2022/2023

Programming with C language and solving problems

Institución
Grado

Vista previa del contenido

SOLENT UNIVERSITY




BSc (Hons) [Foundation]




Michele Accordino

Academic Year 2022-2023




Portfolio




Assignment 1
Submission Date:
3rd February 2023 Before 4pm (UK time)




Unit title: Problem Solving
Unit Code: QHO305
Unit Leather: Dhouha Kbaier




1

, SOLENT UNIVERSITY


Contents
Introduction..........................................................................................................................................3
Logical Operator...........................................................................................................................4
Relational Operator......................................................................................................................5
Escape sequence...........................................................................................................................5
Assessment 1........................................................................................................................................5
Introduction of Variables and Operators...........................................................................................5
Grade D........................................................................................................................................6
Grade C.........................................................................................................................................7
Grade B.........................................................................................................................................8
Grade A.........................................................................................................................................8
Assessment 2......................................................................................................................................10
Introduction of Conditional Statement...........................................................................................10
Grade D.......................................................................................................................................11
Grade C.......................................................................................................................................13
Grade B.......................................................................................................................................14
Grade A.......................................................................................................................................15
Assessment 3......................................................................................................................................17
Introduction of Loops.....................................................................................................................17
Grade D......................................................................................................................................18
Grade C.......................................................................................................................................20
Grade B.......................................................................................................................................22
Grade A.......................................................................................................................................25
Assessment 4......................................................................................................................................27
Grade D......................................................................................................................................27
Grade C.......................................................................................................................................30
Grade B.......................................................................................................................................34
Grade A.......................................................................................................................................36
Assessment 5......................................................................................................................................38
Introduction of Arrays....................................................................................................................38
Grade D......................................................................................................................................39
Grade C.......................................................................................................................................42
Grade B.......................................................................................................................................46
Grade A.......................................................................................................................................54
Differences between getchar(); and scanf();:..............................................................................54
Assessment 6......................................................................................................................................59

2

, SOLENT UNIVERSITY


Introduction to Sorting Algorithm..................................................................................................59
Grade D......................................................................................................................................60
Grade C.......................................................................................................................................61
Grade B.......................................................................................................................................62
Grade A.......................................................................................................................................63
Assessment 7......................................................................................................................................64
Introduction of Function.................................................................................................................64
Recursion....................................................................................................................................65
Grade D......................................................................................................................................66
Grade C.......................................................................................................................................69
Grade B.......................................................................................................................................72
Scope of Variable........................................................................................................................75
Class of Variable.........................................................................................................................75
Grade A.......................................................................................................................................76
Reflecting Report................................................................................................................................80
References..........................................................................................................................................82
Bibliography.......................................................................................................................................83
Appendices.........................................................................................................................................84




Introduction
What is Programming and C language?

3

, SOLENT UNIVERSITY

Programming is a serial of instruction that it is given to the computer. Those must be converted to one of the
languages used in the computer. This process is called compilation and it is using a software application
called compiler. C language is a binary language that the computer understands and one of the most used
programming languages. C was created by Dennis Ritchie at the Bell Laboratories in 1972. C is strongly
associated with UNIX, as it was developed to write the UNIX operating system. For this portfolio will be use
Replit.com but there are other program, like Visual Studio Code. The C program instruction start with the
main function, showed below.

#include <stdio.h>
int main(void)
{printf("Hello World\n");
return 0;}

The library stdio.h is the most used in C programming that contains input and output types, functions that the
program will use, this included almost the 75% of the C library, for example if the program needs
mathematic functions it needs to be included, in addition, #include<math.h>. The int main means that this is
our main function and (void) that doesn’t return to any other function. For include something that needs to be
show in our program we need to start with curly bracket and end with it. Printf followed with open and close
bracket and quotation marks open and close as well, it will print on our console what is inside, in this case
Hello World. \n is an escape sequence that we will talk about on the first assessment and on the end our
return 0; that tell the system that the program it might be terminated (in this assignment return 0; is not using
as not necessary to keep in the program). (Gookin, 2004)
In this Portfolio, it has been divided into functions, as showed below:

#include <stdio.h>
void gradeA();
void gradeB();
void gradeC();
void gradeD();
int main(void) {
int grade;
printf("Select the Grade.\n1-GradeD\n2-GradeC\n3-GradeB\n4-GradeA\
n");
scanf("%d", &grade);
if (grade == 1) {
gradeD();
} else if (grade == 2) {
gradeC();
} else if (grade == 3) {
gradeB();
} else if (grade == 4) {
gradeA();
} else {
printf("Wrong digit! Try again between 1 and 4.");}
}
N.B.: Functions will be explained in Assessment 7 of this Portfolio.




Logical Operator

Logical Operator is using for decision-making, there are three main logical operators showed below.

4

Escuela, estudio y materia

Institución
Estudio
Desconocido
Grado

Información del documento

Subido en
22 de marzo de 2023
Número de páginas
84
Escrito en
2022/2023
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$56.39
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor
Seller avatar
micheleaccordino

Conoce al vendedor

Seller avatar
micheleaccordino Southampton Solent University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1
Miembro desde
3 año
Número de seguidores
0
Documentos
8
Última venta
1 mes hace

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes