Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
211 views

Assignment Lecture 7

This document contains 14 programming practice problems involving writing C++ programs that generate and display different patterns and numbers. The problems include writing programs to display the sum of integers, even numbers, multiples of 5, swapping variables without a third variable, finding multiples of 5 in a range, and printing various half and inverted pyramids using numbers and asterisks.

Uploaded by

Agha Salman Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
211 views

Assignment Lecture 7

This document contains 14 programming practice problems involving writing C++ programs that generate and display different patterns and numbers. The problems include writing programs to display the sum of integers, even numbers, multiples of 5, swapping variables without a third variable, finding multiples of 5 in a range, and printing various half and inverted pyramids using numbers and asterisks.

Uploaded by

Agha Salman Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming Fundamentals

Class Practice Exercise Lecture 7

1. Problem Statement: A person enters the bank and stands in the queue to get
his salary. When his turn comes, he requests the cashier that I need my
salary with minimum notes and coins. Write a program for the cashier that
first asks the cashier to enter the salary amount and then displays the
number of notes and coins of (Rs. 5000, Rs. 1000, Rs. 100, Rs. 50, Rs. 20,
Rs. 10, Rs. 5, Rs. 2 and Re. 1).
2. Problem Statement: Write a program that generates and displays first 10
integer numbers.
3. Problem Statement: Write a program that displays sum of first N integer
numbers. Whereas the number N is provided by the user.
4. Problem Statement: Write a program that generates and displays first N
even numbers. Whereas the number N is provided by the user.
5. Problem Statement: Write a program that generates and displays first N multiples of 5. Whereas
the number N is provided by the user.

6. Problem Statement: Write a program in C++ that asks the user to enter
two integer numbers, stores them in variables num1 and num2
respectively. The program swaps the values of two variables with each
other without using a third variable and displays the values of both the
variables after swapping.
Sample input: num1 = 45 num2 = 94
Sample output: num1 = 94 num2 = 45
7. Problem Statement: Write a program in C++ that asks the user to input

the starting number and ending number of the range. The program
should display the number of multiples of 5 in between that range.
8. Problem Statement: Write a C++ program to print half pyramid using
numbers
1
2
3
4
5

2
3 3
4 4 4
5 5 5 5

9. Problem Statement: Write a C++ program to print inverted half


pyramid as using numbers
5
4
3
2

5 5 5 5
4 4 4
3 3
2

1
10. Problem Statement: Write a C++ program to print inverted half
pyramid as using numbers
1
2
3
4
5
11.

1 1 1 1
2 2 2
3 3
4
Write a C++ program to display reverse pyramid
* * * *
* * *
* *
*

* * * * *
* * * *
* * *
* *
*
12. Problem Statement: Write a C++ program to display Floyd's Triangle
1
2 3
4 5 6
7 8 9 10
13. Problem Statement: Write a C++ program to display following
pattern
1 * * * *
1 2 * * *
1 2 3 * *
1 2 3 4 *
1 2 3 4 5
14. Problem Statement: Write a C++ program to print two pyramids
using asterick *

*
* *
* * *
* *
*

*
*
*
*
*
*
*

*
*
*
*
*
*
*
*
*

*
*
*
*
*
*
*

*
* *
* * *
* *
*

SUBMISSION DATE : None

You might also like