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

Relations and Functions: Class 12
Relation: A relation, R, from a non-empty set A to another non-empty set B, is mathematically defined as an arbitrary subset of the cartesian product of A and B. Domain, Range and Co-domain of the Relation...

How to help students to study in a better way?
How to help students to study in a better way? Nowadays teachers and students had to struggle with how to teach and how to learn. Each teacher has their particular style but then so do most students....

Greek Civilisation
The civilisation was developed around 800bc when the small villages clustered from city-states. They worshipped Zeus (sky god). Poseidon (sea god), Apollo(sun god), Athena(goddess of victory) etc. In...
K

Rational numbers
You have seen different types.of numbers in the earlier classes Eg Natural numbers, whole numbers, integers etc When you want to divide a.pizza into 8 equal parts, each person get 1/8 of it. So we...

6 Tips To Write The Perfect Answer In Cbse Board Exams
Appearing for board exams is a tension-ridden phase in the life of the student and parents alike. Best utilization of time and resources is vital to success in the exam. Plan a schedule for completing...
E

Edusmart Skills

0 0
0

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