Sei sulla pagina 1di 7

Assignment-1

Department of Computer Science & Engineering


Motilal Nehru National Institute of Technology,Allahabad

Subject: Programming & Problem Solving Class: MCA & (1st Semester,2013-2014)

Practical Assignment-01
(Elementary Programming Problems for Beginners)
INSTRUCTIONS
Write comment to make your programs readable.
Use descriptive variables in your programs(Name of the variables should
show their purposes)
PROGRAMS LIST

WAP means Write a program..


1. WAP using function to check if a given integer is a palindrome or
not.
2. WAP using function to count number of digits in a given integer.
3. WAP using function to reverse a given integer.
4. WAP using function to convert a decimal number to its binary
equivalent.
5. WAP using function to convert a decimal number to its octal
equivalent.
6. WAP using function to convert a decimal number to its
hexadecimal equivalent.
7. WAP using function to find the length of a string.
8. WAP using function to count number of characters in a string.
9. WAP using function to count number of vowels in a given string.
10. WAP using function to find the mean of numbers stored in an
array.
11. WAP using function to test if a given number is a prime or not.
12. WAP using function to print all the divisors of a given integers.
13. WAP using function to display integers in an array which are
greater than their mean.
14. WAP using function to add 2 to each elements of a 2-D array and
display them.

1
Assignment-1

15. WAP using function to check if a given string is a palindrome or


not.
16. WAP using function to compare two strings.
17. WAP using function to copy one strings to another string.
18. WAP using function to concatenate two strings.
19. WAP using function that will delete all vowels in a string.(Replace
it by space).
20. WAP using function to change all lowercase characters to
uppercase in a given string.
21. WAP using function that will add two matrices. Don’t use the third
array.
22. WAP using function to print maximum number stored in an array.
23. WAP using function that will delete all duplicate characters from a
string.
24. WAP using function that will print the frequency of each numbers
in an array of numbers.
25. WAP using function that will count the frequency of different
letters in strings.
26. WAP using function that will reverse a string.
27. WAP using function to check if a matrix is symmetric or not.
28. WAP using function to check if a given matrix is antisymmetric or
not.
29. WAP using function that will display a matrix after multiplaying it
by -2.
30. WAP using function to replace each elements of a matrix by its
square.
31. WAP using function to replace each elements of a matrix by 0
which are in odd rows and even columns.
32. WAP using function to replace each element of a matrix by 0
whose sum of indices is even.

2
Assignment-1

33. WAP to print the following patterns(There is a space between each


digits.)
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9

34. WAP to print the following patterns(There is a space between two


digits.)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9

35. WAP to print the following patterns(There is a space between two


digits.)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
3
Assignment-1

1 2 3
1 2
1
36. WAP to print the following patterns(There is a space between two
digits.)
1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
5 4 3 2 1 2 3 4 5
6 5 4 3 2 1 2 3 4 5 6
7 6 5 4 3 2 1 2 3 4 5 6 7

37. WAP to print the following patterns(There is a space between two


digits.)
1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
0123456789876543210

38. WAP to print the following patterns (There is a space between two
stars.)
1
2 1
3 2 1
4 3 2 1
4
Assignment-1

5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
39. WAP to print the following patterns (There is a space between two
stars.)
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1

40. WAP to print the following patterns (There is a space between two
stars.)

1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1
41. WAP to print the following patterns (There is a space between two
stars.)

* *
* * * * * *
5
Assignment-1

* * * * * * * * * *
* * * * * * * * * * *
42. WAP to print the following patterns (There is a space between two
stars.)

* * * * *
* * * *
* * *
* *
*
* *
* * *
* * * *
* * * * *
43. WAP to print the following patterns (There is a space between two
stars.)
* *
* *
* * * *
* * * *
* * * * *
* * * *
* * * *
* *
* *

6
Assignment-1

Prepared By
Manoj Wairya
Associate Professor
Department of Computer Science & Engineering
Motilal Nehru National Institute of Technology,Allahabad

Potrebbero piacerti anche