Lab Exercise 1
Lab Exercise 1
a) Assembler
b) Input unit
c) Programming
d) Assembly language
e) Output unit
f) Translator
(2). b
(3). g
(4). k
(5). n
(6). a
(7).
*
**
***
****
*****
1|Page
(8).
a)
#include <stdio.h>
int main()
{
printf("1,2,3,4");
return 0;
}
b)
#include <stdio.h>
int main()
{
printf("%d %d %d %d", 1, 2, 3, 4);
return 0;
}
c)
#include <stdio.h>
int main()
{
printf("%d ", 1);
printf("%d ", 2);
printf("%d ", 3);
printf("%d ", 4);
return 0;
2|Page
}
(9).
a) The line break should be inside the double quotations,
Correction: printf(“The product of %d and %d is %d\n”, x, y);
b) Sides must be changed
Correction: sumOfNumbers = firstNumber + secondNumber
c) One conversion Specifier is missing
Correction: printf(“Remainder of %d divided by %d is %d\n”, x, y, x % y);
d) The first double quotation is missing
Correction: printf(“%d is equal to %d\n”, x, y);
e) The ‘,’ after the line break should be out of the double quotations
Correction: printf(“The sum is %d\n”, x + y);
f) The second quotation is missing and you should not have ‘&’ in the printf
Correction: printf(“The value you entered is %d\n”, value);
3|Page