LAB 7 - BIC10204

QUESTION a:

a. Create a program to generate a multiplication table by using while loop. The multiply is determined based on user input. Your output should be like below:

Output:

Please enter multiplication table: 3

3 Times Table

1*3=3

2*3=6

..

..

12 * 3 = 36

CODING & OUTPUT a:




QUESTION b:

b. Calculate the total of any five numbers using do ... while loop. Your output should be like below:

Output:

Please enter number 1: 2

Please enter number 2: 3

Please enter number 3: 1

Please enter number 4: 4

Please enter number 5: 5

The total of five numbers is 15


CODING & OUTPUT b:



QUESTION c:

c. Write a program for the following problem by using for statement:

Ahmad saves RM1000 in his account in a bank which returns 5% of annual interest. Assuming that all interests is left deposited in his account, calculate and print the amount of money in his account at the end of each year for 10 years by using for loop. Use the following formula to determine these amounts:

𝑎=𝑝(1+𝑟)^𝑛

Where;

𝑎 = the amount of deposit at the end of nth year

𝑝 = original amount saved

𝑟 = annual interest rate

𝑛 = number of year

CODING & OUTPUT c:


QUESTION d:

Write a C program to produce the following output by implementing nested loop using for statement.

Output:

Number 1 to 10:

Row 1:1 2 3 4 5 6 7 8 9 10

Row 2:1 2 3 4 5 6 7 8 9 10

Row 3:1 2 3 4 5 6 7 8 9 10

Row 4:1 2 3 4 5 6 7 8 9 10

Row 5:1 2 3 4 5 6 7 8 9 10

CODING & OUTPUT d:




                                                                                                     Written by Arif (AI210125)😁.

Comments

Popular reaches : 3

LAB 6 - BIC10204

Lab Task 1 - BIC10503

LAB 4 - BIC10204

Lab Task 6 - BIC10503

Lab Task 3 - BIC10503

LAB 8 - BIC10204