Professional Documents
Culture Documents
New Questions
New Questions
output={1,4,9}
13.wap to print only non intersecting elements from the two given arrays. size o
f both input arrays is equal.
eg:input1={1,2,3,4,5}
input2={2,3,6,7,8}
output={1,4,5,6,7,8}
14.wap to print the elements in first array which is not present in second array
.size of both input arrays is equal.
eg:input1={11,12,13,14,15}
input2={11,13,2,3,4}
output={12,14,15}
15 wap to find strong number or not
br=if element is -ve op=-1
16 wap to find the avg in gn array if any of the elemt greater than avg strore
into output variable
br=array size negative store -1.
17 armstrong between two ranges and find largest one in that.
br: if any range -ve store -1
18 reverse the array elements in array,if range is odd using mid=n/2 formula
br: store -2 if elemnt is even or range -ve,store -1 if any one element is neg
ative
19. del -ve elemts in array nd sum positive ones
br: store -2 if al
l r -ve elemts,store -1 if size -ve
20. wap to display milg of bike based on cc of engine
if cc is 100-125 mil : 75
if cc is 126-135 mil : 70
if cc is 136-145 mil : 65
if cc is 146-155 mil : 60
if cc is 156-165 mil : 55
if cc is 166-175 mil : 50
if cc is 176-200 mil : 45
if cc is 200-220 mil : 40
br : if size is gr8 than 220 op=-2,if size is -ve or less than 100 op=-1;
21.Write a program to find the average of elements present in the prime indices
of the given array.
br:index starts from 1.
22.smallest of four numbers.
Br: If input1<0 op=-1
input1>32767 op=-2
23.Based on input3 perform various operations
input1 & input2 are numbers.
BR: if input3<0 op=-1
BR: input3=1 op=ip1+ip2;
Br:input3=2
op=difference of ip1 &ip2
Br:input3=3
op=mul of ip1 and ip2
Br: input3=4
op=divide input1 by input2
br: if input3 other than above op=-2
24.Add multiples of "input1" till input2 and store in output1
input1=3
input2=15
output1=45
25.input1={1,3,2,3,3,6,4,6,5,9}(id,value,id,....)
input2=10(array size)
add values next to odd id and find average.
output1=18/3=6
br:input1[i]<0 op=-1
input2<0 op=-2
26.input1={12365,12396,12125,12256}
input2=4(arraysize)
input3=123(find this pattern in array and print next numbers in output array)
output1={65,96}
br:input1[i]<0 op=-1
input2<0 op=-2
27.sort array1 in ascd order, array2 in desc order. Multipy 1st elmt in arr1 wi
th last elmt in arr2 and so on. (criscross multiplication) and store in output1
array.
28.extract the even digit
for eg: input:4512
output:42
input:1315
ouput:0
29.find the diff between consecutive elements in array . assign the largest diff
erence to the output
eg: ip={4,10,6,5,3}
op=6;(store the difference between consecutive elements in a seperate arr
ay)
30.
Smallest of four digits.
31.
Input1=[1,2,3,4,5]
input2=[3,4,5,6,7]
output {3,4,
5}
compare the two input array save the common element in a different array. Sort t
he resultant array and save it to output array.
32.
Sort the input array and insert an element to the sorted array.
33.
Input1[]={1,3,5,77,85,66,43,6,2}
Input2[]={65,1,23,3,85,67,34,85,2}
Input3=9
compare the two array for the similar element. ADD the similar elements.
Ans: 1+3+85+2=91
34.
Input1[]={23,54,67,12,45,17,9,66}
input2=8
if age>18, save 5 in the new array else save 4.
Add the new array elements and save it in output variable.
35.
Input1[]={1,3,5,77,85,66,43,6,2}
Input2[]={65,1,23,3,85,67,34,85,2}
Input3=9
Save the common elements from both the array in an new array sort the array and
save it to the output array.
39.input3 must be the size of two arrays input1 and input2 compare the two array
s and store the dissimilar elements in the output array.
example:
input3=4[array size]
input1={2,4,7,8}
input2={3,4,8,9}
output1={2,7,3,9}
40.consider input2 as array size and first index as key and second index as valu
e. value must be stored in input3.store all the key values in the output array.
i.e. store the numbers before the repeating numbers.
business rule:1)if input2<0 output1[0]= -3
2)if elements in the input array is negative output1[0]=
-2
3)if there is no key values output1[0]= -1
example:
input2=8
input1={1,4,2,4,3,4,5,6}
input3=4
output1={1,2,3}
41.find the largest armstrong number among the given input range.
example: range is, input1 =300 between input2=500
output1=407
42.second smallest number in a array
43.second largest divisor of a given input
example:input1=21 (divisors of 21 are 1,3,7,21)
output1=7
44.smallest of 4 inputs without using array
45.number of numbers repeating in an array
46.store the repeated elements in a array and sort them in ascending order
47.factorial for a given number. if number is greater than 7 output should be -1
48.print the digits count in the following format.
example:
input1={1,23,2,34,456,67}
output1={1,no of single digits,2, no of 2 digits and so on}
output1={1,2,2,3,3,1}
49.find the next odd and even number
i/p=123
o/p=345
50.return the number that ends with 2 and 5.
i/p:{22,23,24,25}
o/p:{22,25}
51.sum of the factorial of prime numbers
i/p:{6,7,8,9,11}
in the i/p 7 and 11 is prime, need to find the factorial
for 7 and 11 and summ the value.