You are on page 1of 8

LAB REPORT ECE

126
INTRODUCTION TO C PROGRAMMING AND
FORMATTED I/O
(EXPERIMENT 1)

LECTURER :

GROUP MEMBERS :
1.FARDIANA EDRINA BINTI MOHAMMAD SHAARI
2.FATIN ATIKAH BINTI MD YA’ACOB
3.ARESSA SOFEA BINTI SHAHARUDIN
OBJECTIVES

The objectives of the experiment introduction to C programming and


formatted I/O are to identifying the CodeBlocks Integrated
Development Environment (IDE). Gaining knowledge about coding,
debugging, compiling, and executing C codes using CodeBlocks IDE.
To studies the function and using print and scanf .The applying basic
arithmetic operations and about controlling the output and input
format using printf and scanf.
RESULT PART A (WELCOME TO C)

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Hello world!\n");
return 0;
}
DISCUSSION PART A (WELCOME TO C)
Experiment 1 Part A (welcome to C) are the introduction to the
programming. There are many programming software but
CodeBlocks are the main software of doing this experiment.
CodeBlocks is an open source software that gained from Integrated
Development Environment (IDE). Function of the software are
allowing the users to debug their programme by having access to
their function. Basically this software provides many type of
programme such as C, C++, and others. C programme helps you to
understand the internal architecture of a computer, how computer
stores and retrieves information. In the experiment 1, the uses of C
programme is important. From the procedure shows on how to
create a new project and save it into a folder by using the
CodeBlocks. The first task is “Hello world!” is written in the main c by
clicking the button of sources. To check there is an errors or not, the
build and run button were used to comfirm there is no errors in the
workspace. It is more easier to identify the errors of coding. Starting
with the common pre-processor directives #include
<studio.h> and #include <stdlib.h> telling the copiler
to include input or output library. Then the int main() is defining
a main function. Printf(“Hello world!\n”); the main
function calling library output function to print the text enclose by
symbol double quote. In the below of this word written return 0;
impliying normal termination of the program. The open and close
braces {} enclose the main function of the program. In this
experiment part A also had major implementation issue for a
beginner student. For example the carelessness about the symbols or
typos while doing the experiment. In which of the typos and
carelessness bringing the bugs and error to the programme then
allows the programme not displaying the written task. It is important
to keep full attention and focusing while doing the experiment.

CONCLUSION PART A (WELCOME TO C)


In conclusion from the experiment 1 part A , welcome to C shows
that the functions and works of the C programming. The purpose of
doing the experiment 1 part A is to introduce the uses of C
programming to students. Then purpose of doing this experiment 1
part A also makes students being interested about doing the
programming. A single type of the description written in the
programme shows their own functions and able to perform and
display it correctly. Importance of avoiding the carelessness that
cause an errors an bugs into the programme. From the result part A
shows that there is no errors in the programme and written correctly
complete with all of the symbols and functioning well. The
uncertainties of errors beyond of controls coming from the bugs of
the computer and it can effect the experiment but it can correct it as
well. The C programming introduction were raise the knowledge of
the students and it can be observed correctly for references the
other part.
RESULT PART B (VARIABLES AND DATA TYPES)

#include <stdio.h>
#include <stdlib.h>
int main()
int var1; // declare variable var1 type int
var1 = 5; // store value of 5 into variable var1
char var2;
var2 = 'a';
float var3;
var3 = 10.54;
double var4;
var4 =205.7256;
printf("The value of variable var1 is %d\n", var1);
printf("The value of variable var2 is %c\n", var2);
printf("The value of variable var3 is %f\n", var3);
printf("The value of variable var1 is %1f\n", var4);
return 0;
}

DISCUSSION PART B (VARIABLES AND DATA TYPES)


The experiment 1 part B (variables and data types) are about the
deep details of the programme and to insert the stated variable, data
types and value of the programme. Variables are the nouns of a
programming language , they are the entities (values, data) that act
or are acted upon. The character-counting program uses two
variables. The program increments count each time it reads a
character from the input source and ignores args. A new project
were created named 1-DataType. Started with stdio.h at the
header of file and were defined the main () function. The
statement were declared the variables are int var1; //
declare variable var1 type int and var1 = 5;
//store value of 5 into variable var1 and then it
were repeated with variable var2, var3 and var4. All these
variable had different data type like char, float, and double.
The value were inserted into the statement of the variable. Printf
were used to output the content of variable by following the output
statement of the variable. The procedure was repeated for all
content of variable using their corresponding conversion specifiers
like %c, %f and %lf.% means the modulus and each word like c
shows a single character, f means that the floating point and lf
means a format string for double. Each variables were declared and
assingned a value statement like the result part B. Same goes to var2,
var3 and var4. All of these were combined and produced the result
after build and run to identify there is no errors occurred.The major
implementation issue in this experiments are the lack of knowledge
about the variables and conversion specifiers. The carelessness of
doing this experiment rapidly while declaring due to error and typos
or missing any symbol of variables. All of these implementation issue
lead to the bugs and some errors in the experiment like the
programme could not build and run. The prevention were made by
checking the error and do the corrections.
CONCLUSION PART B (VARIABLES AND DATA TYPES)
In conclusion from the experiment 1 part B (variables and data
types), shows that the knowledge about the variables and
corresponding conversion specifier are important before write the
statement to declare variables. It is important to keep focus while
writing the statement to avoid any typos that will cause an error.
Data types shows many function with different data type like char,
float, double and others. Experiment 1 part B deeply explained about
variables and data types.

You might also like