0% found this document useful (0 votes)
2 views2 pages

Basic Programming Questions Final

The document outlines several programming problems and their solutions, including checking for palindromes, prime numbers, reversing numbers, counting digits, finding the largest element in an array, performing linear search, and printing number and alphabet patterns. Each problem includes example inputs and expected outputs. The problems are designed to enhance programming skills and algorithmic thinking.

Uploaded by

b7396753
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Basic Programming Questions Final

The document outlines several programming problems and their solutions, including checking for palindromes, prime numbers, reversing numbers, counting digits, finding the largest element in an array, performing linear search, and printing number and alphabet patterns. Each problem includes example inputs and expected outputs. The problems are designed to enhance programming skills and algorithmic thinking.

Uploaded by

b7396753
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Check Palindrome

Problem: Write a program to check whether a given number is a palindrome.


Input: n = 121
Output: Palindrome

Input: n = 123
Output: Not Palindrome

2. Check for Prime Number

Problem: Write a program to check whether a given number is prime.


Input: n = 7
Output: Prime

Input: n = 10
Output: Not Prime

3. Reverse a Number

Problem: Write a program to reverse a given number.


Input: n = 1234
Output: 4321

4. Count Digits

Problem: Write a program to count the number of digits in a given number.


Input: n = 56789
Output: 5

5. Largest Element in an Array

Problem: Find the largest element in an array.


Input: arr = [10, 45, 3, 99, 23]
Output: 99

6. Linear Search in Array

Problem: Search an element using linear search.


Input: arr = [2, 4, 6, 8, 10], key = 6
Output: Found at index 2

Input: key = 7
Output: Not Found
7. Number Pattern (Corrected)

Problem: Write a program to print the following pattern.

Input: n = 4
Output:
1
12 21
123 321
1234 4321

8. Alphabet Pattern

Problem: Write a program to print the following alphabet pattern.

Input: n = 5
Output:
A
BB
CCC
DDDD
EEEEE

You might also like