Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Lab 2

1. What is source code?


2. What is object code?
3. List 2 types of libraries used in C.
4. List 3 types of errors that can occur.
5. Copy the following source codes. Compile and run them separately.
a)

#include <stdio.h>

int main()
{
printf("Good Day");
return 0;
}

b)

#include <stdio.h>

int main()
{
printf("\tGood \t Good\n");
printf("Good \t\t\" Good\n");
printf("\tGood \\Good\n");
return 0;
}

c)
#include <stdio.h>

int main()
{
int a =1, b =2, c;
c=a+b;
printf("c = %d\n", c);
}

d)

#include <stdio.h>

int main()
{
int num1, num2, sum;
printf("Enter 2 numbers: ");
scanf("%d%d",&num1,&num2);
sum = num1+num2;
printf("Sum of two number is %d\n", sum);
}

You might also like