Lab 05
Lab 05
PROGRAMMING FUNDAMENTALS
Lab 05: Understanding Switch Case and For loop
Under
Practice Exercise 05: A For loop example: Finding factorial of given number.
Exercise:
1:
2:
3:
Input two integers and find if they are equal, smaller or greater to eachother.
4:
a. Write a program in C++ using loops to print even numbers from 1 to 100.
b. Write a program in C++ using for loop to print below pattern:
1
1 3
1 3 5
1 3 5 7
5:
A bank in your town updates its customers’ accounts at the end of each month. The bank offerstwo
types of accounts: savings and checking. Every customer must maintain a minimum balance. If a
customer’s balance falls below the minimum balance, there is a service charge of $10.00 for savings
accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the
minimum balance, the account receives interest as follows:
Write a program that reads a customer’s account number (int type), account type (char; s for
savings, c for checking), minimum balance that the account should maintain, and current balance.
The program should then output the account number, account type, current balance, and an
appropriate message. Test your program by running it five times, using the following data: