UrbanPro
true

Search in

BlueJ Program For CBSC/ICSE Student

BISHAL SAHA
19/09/2017 0 0

Consecutive numbers program using array:

class Consecutive
{
public static void main(String[] args)
{
int a[]={52,10,85,14,32,78,15,11,53,86};
int p=a.length;
System.out.println("====Consecutive Numbers Are:====");
for(int i=0;i<p;i++)
{
for(int j=i+1;j<p;j++)
{

if((a[i]+1)==a[j])
{
System.out.println(a[i]+","+a[j]);
}
else{
if(a[i]==a[j]+1)
{
System.out.println(a[j]+","+a[i]);
}
}

}
}
}
}

0 Dislike
Follow 2

Please Enter a comment

Submit

Other Lessons for You

Mathematics: Trigonometric
1. ( sinA )2 + (cosA)2 = 1 2. (tanA)2 + (cotA)2 = 1 3. SinA = 1 /cosecA 4. CosA = 1 /secA 5. TanA = 1/cotA (also inverse as secA= 1/ CosA) 6. sin2a = 2 sinA CosA 7. cos2a = (cosa)2 -...
A

Amar Singh

0 0
0


Conservation of energy for a falling body
Law of conservation of energy - Energy can neither be created nor be destroyed; it can only be transformed from one form to another. Consider a body of mass m placed at A. h = AB is the height of...

Reflection Of Light (Questions)
Reflection of Light Rays on a Reflecting Surface: When a light ray strikes a surface separating two media with different optical properties, part of the light energy is reflected back to the media where...

An Overview of Cell
Cell biology is a branch of biology which deals with the study of cells. Cells are building blocks of living organisms and fundamental unit. Organisms are made up of different types of cells, and cells...
X

Looking for CBSE Schools Classes?

The best tutors for CBSE Schools Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn CBSE Schools with the Best Tutors

The best Tutors for CBSE Schools Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more