Practical File Xi
Practical File Xi
FILE PROGRAMS
1. WAP to accept 2 numbers from the user and swap these two numbers.
2. WAP to convert the temperature from Celsius to Fahrenheit and vice versa
3. WAP to accept a number from user and print its factorial using for loop
4. WAP to accept a number from user and print it in reverse order.
5. WAP to find the sum of digits of a given number n, where n is entered by the user using while
loop.
6. WAP to print the Fibonacci series as follows:
0,1,1,2,3,5,8……n
7. WAP to find the sum of even and odd numbers where n is the limit entered by the user.
8. WAP to check if the given number is a palindrome or not.
9. Write a menu driven program given in assignment 4 page no 223. Loops chapter
10. WAP to print the average of N natural numbers
11. WAP to calculate the sum of series :
1+x+x2+x3+………xn
12. WAP to check if the entered string is a palindrome or not.
13. WAP (menu driven) to accept a string from the user and perform the following operations on the
string.
a. Total number of characters
b. Total number of alphabets
c. Total number of digits
d. Total number of vowels
e. Total number of spaces
14. WAP which accepts an integer list and exchanges the values of first half side with second half
side.
For eg.- [1,2,3,4,5,6,7,8] – [5,6,7,8,1,2,3,4]
15. WAP to check if the elements of a list are divisible by 7, if yes then replace the element by
previous element.
16. WAP to modify the content of a list in such a way that the elements which are multiples of 10
swap with the value present in the very next position in the list.
For eg:
L= [40,34,35,10,28,22]
o/p should be [34,40,35,28,10,22]
17. WAP to shift the positive numbers to the right side of the list and negative numbers to the left side
of the list.
For eg:
L = [-1,2,3,-4,-5,8,9]
o/p should be [-1,-4,-5,2,3,8,9]
18. WAP to display all the duplicate and unique elements from the list.
19. WAP to create a list and search for a particular element with its position in the list.
20. WAP to convert a date in form “dd/mm/yyyy” to Day Month, year.