Friday, June 2, 2023

11 Sample programmes

 

  1. Write a program to calculate the factorial of a number using a recursive function.

  2. Implement a PHP script to find the largest element in an array.

  3. Create a program that converts a string to uppercase without using built-in functions.

  4. Write a PHP script to check if a given number is prime.

  5. Implement a program to reverse a string without using built-in functions.

  6. Create a PHP script that generates a random password of a specified length.

  7. Write a program to calculate the sum of digits in a given number.

  8. Implement a script that finds the second-largest element in an array.

  9. Create a program to check if a given string is a palindrome.

  10. Write a PHP script to sort an array in ascending order.

  11. Implement a program to calculate the Fibonacci series up to a given number of terms.

  12. Create a PHP script that validates an email address.

  13. Write a program to find the average of numbers in an array.

  14. Implement a script to count the occurrences of each character in a string.

  15. Create a PHP program to check if a given year is a leap year.

  16. Write a program to find the greatest common divisor (GCD) of two numbers.

  17. Implement a script that reverses the order of words in a sentence.

  18. Create a PHP program to calculate the sum of all even numbers between two given numbers.

  19. Write a program to check if a given string contains a specific substring.

  20. Implement a script that removes duplicate elements from an array.

  21. Create a PHP program to convert a decimal number to binary.

  22. Write a program to find the length of the longest word in a sentence.

  23. Implement a script to check if two strings are anagrams.

  24. Create a PHP program to find the square root of a given number.

  25. Write a program to calculate the power of a number using a recursive function.

  26. Implement a script that removes all whitespace characters from a string.

  27. Create a PHP program to reverse the order of elements in an array.

  28. Write a program to check if a given number is Armstrong.

  29. Implement a script that counts the number of vowels and consonants in a string.

  30. Create a PHP program to find the LCM of two numbers.

  31. Write a program to sort an associative array by its values.

  32. Implement a script that checks if a string is a valid palindrome ignoring spaces and punctuation.

  33. Create a PHP program to generate all possible combinations of a given set of elements.

  34. Write a program to find the sum of all prime numbers in a given range.

  35. Implement a script that calculates the factorial of a number using an iterative approach.

  36. Create a PHP program to check if a given string is an anagram of a palindrome.

  37. Write a program to reverse the order of elements in an associative array.

  38. Implement a script to remove duplicate characters from a string.

  39. Create a PHP program to check if a given number is a perfect number.

  40. Write a program to count the number of words in a sentence.

  41. Implement a script that converts a string to title case.

  42. Create a PHP program to find the median of an array of numbers.

  43. Write a program to check if a given string is a valid IP address.

  44. Implement a script that finds the common elements between two arrays.

  45. Create a PHP program to generate the nth Fibonacci number.

  46. Write a program to find the first non-repeated character in a string.

  47. Implement a script that finds the missing number in a given array of consecutive numbers.

  48. Create a PHP program to check if a given number is a strong number.

  49. Write a program to count the number of occurrences of a word in a sentence.

  50. Implement a script that converts a number to its Roman numeral equivalent.








No comments:

Post a Comment