0% found this document useful (0 votes)
29 views

Java Program

The document contains examples of problems and their solutions involving arrays and strings. It includes merging and sorting arrays, finding intersections and contiguous sequences, manipulating strings, and performing calculations on numbers.

Uploaded by

amitchavn2000
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Java Program

The document contains examples of problems and their solutions involving arrays and strings. It includes merging and sorting arrays, finding intersections and contiguous sequences, manipulating strings, and performing calculations on numbers.

Uploaded by

amitchavn2000
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

// Enter two arrays from keyboard and merge them in a such way that all

// elements in the increasing order.


==================================================================================

// WAP to collect all negative elements at left and all positive at rh+ side of
array

e.g.
Input Array:
34 -4 23 9 -2 201 -11 85 -34 -1

Processed array:
-4 -2 -11 -34 -1 34 23 9 201 85
===================================================================================
=====

WAP to find the intersection of two arrays.

x
{ 23,-5,89,12,9 }

y
{ 9,-34,12,100,-5 }

Intersection:
{ -5, 12, 9 }

===================================================================================
========

// WAP to merge the two different arrays in a such way that there should not be
// any duplicate element.
===================================================================================
==================

Enter the array of +ve and -ve elements, and find series of elements
having summation zero.

2 5 -3 -4 9 -3 -5 1 4

2 5 -3 -4
5 -3 -4 9 -3 -5 1
-5 1 4

===================================================================================
===============
// WAP to find the contiguous increasing subsequnce in array

223 39 2 7 23 89 -12 90 190


255

contiguous increasing subsequnce:

2 7 23 89
90 190 255
===================================================================================
==================

// WAP to store the runs scored by 3 player in 5 matches and display all runs
with total

===================================================================================
==================
// WAP to convert the string into uppercase

===================================================================================
======================
// reverse copy, reverse at same location
===================================================================================
==============

WAP to display the starting character of each word from entered string.

str --> hi all how are you


output -> hahay
===================================================================================
==============

WAP to display the starting character of each word from entered string and word
count.

(with multiple spaces)

===================================================================================
==============
// WAP to convert the string in to title case

str ---> CPP is superset of c programming

outut --> Cpp Is Superset Of C Programming


===================================================================================
====================

// WAP to interchanger first and last character of each word from string.

str --> ---hello good evening abhijeet and prachi

o/p --> oellh doog gvenine tbhijeea dna irachp

===================================================================================
================
// WAP to find the all lowercase missing alphabets from lowercase string.
===================================================================================
=================

// WAP To Find The word with highest length from string

e.g.

str --> ----hello good day abhijeet and prachi

word with max length: "abhijeet"


===================================================================================
========

// Enter any no and count digits from it


e.g.
no=1385 Digit Count: 4
===================================================================================
==========

// Enter any number and count the even digits in that number
e.g.
no=34562, Even Digit Count: 3

===================================================================================
=

// WAP To find max digit in a number

3856 ---> ans: 8

===================================================================================
========

// Enter any no and add the even and odd digits from it separately

24385 ==> 5 + 3 = 8
8 + 4 + 2 = 14

===================================================================================
========

// Enter the number and add the alternate digit from it.

no=28416 ==> 6+4+2 = 12


1+8 = 9
==========================================================================

// Enter the number and find its factorial

no=5 5! = 5 * 4 * 3 * 2 * 1 ==> 120

================================================================================

// WAP to find the rep of each digit 188311 --> - 1 rep 3 times
- 8 rep 2 times
==================================================================================

// WAP to find the entered number is Armstrong or not

===================================================================================
// WAP to generate the max number using the digits of entered number

4936 --> 9643


==============================================================================

// WAP TO DISPLAY THE ENTERED NUMBER IS PRIME OR NOT.


===================================================================================
============
// WAP to generate the two max numbers using the even and odd digits of number
entered thw keyboard

===================================================================================
============

You might also like