Career Avisory and Augmentation School (CAAS)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Career Avisory And Augmentation School (CAAS)

Q.1.
Write a program to print all the LEADERS in the array. An element is leader if it
is greater than all the elements to its right side. And the rightmost element is
always a leader.
For example:
array ={16, 17, 4, 3, 5, 2}, leaders are 17, 5 and 2.

Q.2.
GCD of N numbers.
Input an integer value N, and N number of array elements.
Output: Print GCD.
Ex-1:
Input : 3 , [2,4,8]
Output : 2
Ex-2:
Input : 5, [12,36,24,60,72]
Output : 12
Career Avisory And Augmentation School (CAAS)
Q.3
Print the following pattern.

If the value of N =4,


1111112
3222222
3333334
5444444
If the value of N=6 ,
1111112
3222222
3333334
5444444
5555556
7666666

Q.4.
Merge and Sort 2 arrays.
Write a function to return a sorted array after merging two unsorted arrays, the
parameters will be two integer pointers for referencing arrays and two int
variable, the length of arrays (Use malloc() to allocate memory for 3rd array):
Ex:
Input : arr1[] : 2,1,5,6
arr2[] : 7,5,6,9
Output: 1,2,5,5,6,6,7,9
Career Avisory And Augmentation School (CAAS)
Q.5.
Write a program to check a string is palindrome or not using pointer.
Example: The word which reverse is same is known as palindrome.
I/P : malayalam
O/P: Palindrome.
Q.6.

Input number of lines (n) .Print the following pattern.


If value of n =4 , it prints
1
3*2
4*5*6
10*9*8*7
If the value of n=5 ,it prints
1
3*2
4*5*6
10*9*8*7
11*12*13*14*15

You might also like