You are on page 1of 2

C PROGRAMMING

HELLOWORLD
LAB EXERCISES
INTRODUCTION
Practice the ‘my first program’ code in the lecture slides and modify it as much as you can to
learn what has been taught so far.
What you need…

1. An IDE, recommended one is Code blocks. Visit Code::Blocks - Code::Blocks


2. https://www.youtube.com/watch?v=GWJqsmitR2I&t=5s Use this as a guide
for the installation.
3. Yourself, your attention and patience. Trust me, you need these.

Practice
1. Run the code below:

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

2. Write a block comment containing your name and student number:


/* Name: Kofi Mensah
Student No: 20312345 */

3. Write a line comment describing what the printf statement is doing

// Displays the text

T-S ADJAIDOO 1
4. Change the ‘Hello, World!’ text to your name and run the code:
printf("Kofi Mensah\n");

5. Declare an integer variable called age


6. Assign a value to the variable age
7. Modify the printf statement to print the value of age like this:

int age;
age = 20;
printf("Kofi Mensah is %d years old \n", age);

T-S ADJAIDOO 2

You might also like