Home Page > > Details

Laboratory #2 Session 2-3

Topic:

Conditional statement

Loops

1.Write a C+ program to read a number n and to display the first n naturals numbers and their sum. Expected Output (for 10):

The first 10 natural number is:

1 2 3 4 5 6 7 8 9 10

The sum is: 55

2.Write a C++ program to read a number (integer) and to display its multiplication table

3.Write a C++ program to read a number (integer) and to compute if it is prime or not.

4.Write a C++ program to find prime number within a range.

5.Write a C++ program to read a number and to display a right angle triangle using an asterisk as following:

The number given by the user defines the number of row. (There is a space between each asterisk)

6.Write a C++ program to read a number and to display a right angle triangle using number as following:

1

1 2

1 2 3

1 2 3 4

The number given by the user defines the number of row. (There is a space between each number)

7.Write a C++ program to read a number and to display a right angle triangle using number as following:

1

2 2

3 3 3

4 4 4 4

The number given by the user defines the number of row. (There is a space between each number)

8.Write a C++ program to read a number and to display a pyramid using an asterisk as following:

The number given by the user defines the number of row. (There is a space between each asterisk)

9.Write a C++ program to read a number and to display a pyramid using an asterisk where each row contain and odd number of asterisks as following:

The number given by the user defines the number of row. (There is a space between each asterisk)

10.Write a C++ program to read a number and to display the triangle that have the following patern:

1

0 1

1 0 1

0 1 0 1

1 0 1 0 1

The number given by the user defines the number of row.

11.Write a C++ program to read a number and to display a pattern like a diamond. Each row contain and odd number.

12.Write a C++ program to read two numbers (integer) and to find greatest common divisor (GCD).

13.Write a C++ program to read a number n and to find all strong numbers within the range [1..n]. (As reminder, a strong number is a special number whose sum of the factorial of digites is equal to the original number. For exemple 145 is a strong number because 1! + 4! + 5! = 145.

14.Write a C++ program to read a number (integer) and to check if it is an Armstrong number. As reminder, an Armstrong number is a non-zero number which is equal to the sum of the pth powers of its digits in base ten, where p is the number of digits of n. For Example: 153 is an Armstrong number because 156 = 13 + 53 + 33.

Laboratory #3 Session 3-4

Topic:

Conditional statement

Loops

Arrays

You can use https://www.onlinegdb.com/online_c_compiler to complete these exercises. Use C++14 17 or 20.

15.Write a C++ program to read an array and to count a total number of duplicate elements .

16.Write a C++ program to read and to display all unique elements.

17.Write a C++ program to read an array and to display the frequency of each element. For example, for the array [7; 4; 9; 7]. It prints

7 occurs 2 times

4 occurs 1 times

9 occurs 1 times

18.Write a C++ program to read an array and to find the maximum and minimum elements.

19.Write a C++ program to read an array and to separate odd and even numbers in two separate arrays.

20.Write a C++ program to sort elements of an array in descending order.

21.Write a C++ program to delete an element at desired position from an array.

22.Write a C++ program to randomly generate two arrays and to count the total number in common.

23.Write a C++ program to convert a number into binay.

24.Write a C++ program to check if a given number n appears more then m/2 times in a sorted array of m integers

25.Write a C++ program to find majority element of an array.

26.Write a C++ program to check wheter an array is a subset of another array. For example, for given arrays tab1 [7; 9; 11; 0; 3; 20; 4] and tab2 [11; 7; 0; 3]. tab2 is a subarray of tab1

Contact Us(Ghostwriter Service)

- QQ：99515681
- WeChat：codinghelp
- Email：99515681@qq.com
- Work Time：8:00-23:00

- Ece2072help With ,Help With Python/C++... 2022-10-06
- Help With Pc1201,Help With C++，Java P... 2022-10-06
- Fit2014help With ,C/C++ Programminghel... 2022-10-05
- Wp2250help With ,Java Programminghelp ... 2022-10-05
- Fit2102help With ,Java Programminghelp... 2022-09-06
- Qbus6600help With ,Help With Python Pr... 2022-09-06
- Finc3017help With ,Java/Python Program... 2022-09-05
- Mast90083help With ,Help With Java,Pyt... 2022-09-05
- Help With Cosc 1114,Help With C/C++ Pr... 2022-09-05
- Help With Math3075,Help With C++,Pytho... 2022-09-04
- Elen90055help With ,Help With Java,C++... 2022-09-04
- Ecmt2130help With ,Help With R Program... 2022-09-04
- Help With Elec2103,Help With Matlab Pr... 2022-09-03
- Help With Mcd4700,Help With Java,Pytho... 2022-09-03
- Mat1856/Apm466: Mathematical Finance A... 2022-08-21
- Ecse-324 Lab 3 2022-08-21
- Help With Program Programming,Help Wit... 2022-08-21
- Help With Program,Java Programminghelp... 2022-08-21
- Comp3670help With ,Help With Java,Pyth... 2022-08-21
- Help With Data Programming,Help With C... 2022-08-20

Contact Us - Email：99515681@qq.com WeChat：codinghelp

© 2021 www.asgnhelp.com

Programming Assignment Help！