You are on page 1of 1

LAB Exercise - 1

1. Declaration and Assignment with integers:

a. Define an integer called a.

b. Print the value of a.

c. Assign 5 to a.

d. Print the value of a.

2. Console Input (scanf)

a. Declare an integer called b.

b. Prompt (ask) the user for the value of b.

c. Print the value of b.

3. Addition of Two Integers:

a. Declare an integer called firstNumber.

b. Declare an integer called secondNumber.

c. Declare an integer called sum.

d. Prompt (ask) the user for the value of firstNumber and secondNumber.

e. Assign the sum of firstNumber and secondNumber to sum.

f. Print the result like firstNumber + secondNumber = sum.

4. Perimeter and Area of Rectangle:

a. Declare an integer called length.

b. Declare an integer called width.

c. Prompt (ask) the user for the value of length and width.

d. Print the perimeter of rectangle.

e. Print the area of rectangle.

You might also like