Вы находитесь на странице: 1из 2

Delhi Public School, R.K.

Puram Computer Science

13 Write a program in C++ to accept values of N integers from the user and display their sum.

14. Write a program in C++ to accept N number of characters from the user and display a message
corresponding to each character entered as follows:
“Alpha” - For any alphabet entered
“Digit” - For any digit entered
“Special” - For any character which is neither alphabet nor digit
Also display the total number of alphabets, digits and special characters entered by the user.

15. Write a program in C++ to accept an integer and display its factorial. Factorial of a number N is
calculated as 1 x 2 x 3 x 4 x ...x N.

16. Write a program in C++ to accept an integer X and another integer Y and calculate and display the
result of X​Y​.

17. Write a program in C++ to enter marks obtained by N number of students for a test (max marks out
of 100), find & display grades as per the following grade table and also display the total number of
students getting each grade.
Grade Marks Range
A 100>= Marks >90
B 90 >= Marks >70
C 70 >= Marks > 50
D 50 >= Marks > 32
E 32 >= Marks > 0

18. Write a program to enter an integer and display whether it is prime or composite.

19. Write a program to enter an integer and display whether it is an Angstrom’s Number or not. A
Angstrom’s Number is such a number whose sum of cubes of each digit is equal to the number
itself. For example, 153 is an Angstrom’s Number since 1​3​ + 5​3​ + 3​3​ = 153

20. Write a menu driven program which accepts a user’s choice to calculate and display area of any of
the following shapes, with required inputs entered by the user for the desired shape:
Area of a rectangle
Area of a triangle
Area of a circle
The menu should keep reappearing till the user chooses an option EXIT to exit the program
execution.

21. Write programs to accept value of N from the user and display the sum of each of the following
series:
(a) 1 + (1 + 2) + (1 + 2 + 3) + ... upto N terms
(b) 1! + 2! + 3! + ... upto N terms
(c) 1! + 3! + 5! + ...upto N terms
(d) 2! + 4! + 6! + ...upto N terms

(Note: ! represents factorial)

Practical List 2:Introduction to C++ CScXI/2016_2017/MD/05 #1


Delhi Public School, R.K.Puram Computer Science

22. Write programs to accept values of X and N the user and display the sum of each of the following
series:
(a) X + X 2​​ + X​3​ + ... upto N terms
(b) X + X​3​ + X​5​ + ... upto N terms
(c) X/1! + X​2​/2! + X​3​/3! + ...upto N terms
(d) X - X​2​ + X​3​ - X​4​ ...upto N terms

23. Write programs to display each of the following patterns:


(a) 1 (b) 1 (c) 5 4321
12 22 4 321
123 333 3 21
1234 4444 2 1
12345 55555 1

(d) * (e) * **** (f) *


* * * *** **
* ** * ** ***
* *** * * ****
* **** * *****

(g) * (h) 1 (i) 1


** 12 121
*** 123 12321
** 12 121
* 1 1

_______________________________________________________________________________________
General Instructions:
i. Type the solutions of the above mentioned problems during the Lab Periods
ii. Type the following on top of your program code with desired information about each of your
program as comment line (in the same format)
/*
Program No : 13
Developed By : Ramesh Charya, Harish Madhwan, Zara Khan
Class Section : XI G
Date : 20-August-2016
*/
iii. On successful compilation and execution, copy and paste the sample output at the bottom of the
program as comment lines.
iv. Take out a hardcopy (printout) of the program from printer and get it signed from the respective
computer teacher. Attach the print out in a Computer Practical File and get the index entry of the
same also signed.

Practical List 2:Introduction to C++ CScXI/2016_2017/MD/05 #2

Вам также может понравиться