[SOLVED] CS2092D-ASSIGNMENT 0

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

QUESTIONS

1.    Write a C program to check whether an input integer number is palindrome or not.

Input format:

•   The input is an integer n ∈ [0,105].

Output format:

•   If the integer is palindrome, print YES.

•   If the integer is not palindrome, print NO.

Sample Input 1: 1221

Sample Output 1: YES

Sample Input 2: 1225

Sample Output 2:NO

2.    Write a C program to count how many palindromes are present in a given array of integers. Program must have a separate function PALINDROME(int) to check whether an integer is palindrome.

Input format:

•   The first line of the input contains an integer n ∈ [0,104], the size of the array A.

•   The second line lists the n elements in A, as space-separated integers in the range [−1000,1000].

Output format:

•   An integer indicating the count of palindromes in the input array

Sample Input 1:

7

25 55 75 101 131 215 252

Sample Output 1:

4

Sample Input 2:

5

10 35 65 123 155

Sample Output 2:

0

2

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.