Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  India NewsIndia News  
Keywords
CASE graph 2009 2007 SELECT question papers ICSE RESULT 2006 YEAR 2004 computer 2010 prelim UNION physics paper CLASS science
Latest topics
» Nitration of aniline - IIT JEE 2018 Advanced - solved
HELP ME IN THIS ARRAY PROGRAMME EmptyFri Jun 08, 2018 2:34 am by adianadiadi

» Diamagnetic - Paramagnetic - Ni(CO)4, [Ni(CN)4]2- and [NiCl4
HELP ME IN THIS ARRAY PROGRAMME EmptyFri Apr 06, 2018 1:05 am by adianadiadi

» IIT JEE chemistry solved interactive question paper
HELP ME IN THIS ARRAY PROGRAMME EmptySun Oct 29, 2017 12:11 pm by adianadiadi

» IIT JEE 2015 SOLVED QUESTION PAPER
HELP ME IN THIS ARRAY PROGRAMME EmptyWed Oct 19, 2016 1:44 pm by adianadiadi

» IIT JEE chemistry solved questions
HELP ME IN THIS ARRAY PROGRAMME EmptySat Jul 18, 2015 6:15 pm by adianadiadi

» General Description of Chinese Market for Foaming Agent ADC
HELP ME IN THIS ARRAY PROGRAMME EmptyFri May 09, 2014 2:09 pm by happybaicaitou

» How to get Lowest Cost MBBS Admission?
HELP ME IN THIS ARRAY PROGRAMME EmptyMon Feb 24, 2014 6:39 pm by MENTOR 2014

»  girl boy vashikaran specialist agori baba ji +91-9461165
HELP ME IN THIS ARRAY PROGRAMME EmptyTue Jan 21, 2014 6:00 pm by krshastri

»  STRONG LOST LOVE SPELL +91-9461165176
HELP ME IN THIS ARRAY PROGRAMME EmptyTue Jan 21, 2014 6:00 pm by krshastri

Top posters
abhas
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
Anu..i luv icse...:)
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
G-7
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
siya
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
Candy
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
jOhNy
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
Apurva
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
WinRrule
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
ambili
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 
saif
HELP ME IN THIS ARRAY PROGRAMME Vote_lcapHELP ME IN THIS ARRAY PROGRAMME Voting_barHELP ME IN THIS ARRAY PROGRAMME Vote_rcap 



Search if you can't find it here

HELP ME IN THIS ARRAY PROGRAMME

View previous topic View next topic Go down
AuthorMessage
arunnambiar1994
Active member
Active member



HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyFri Jan 30, 2009 6:09 pm

PLEASE HELP ME WHY THERE IS A ERROR MESSAGE"ArrayIndexOutOfBounds:-1"WHILE I RUN THE PROGRAMME ON MY COMPUTER

import java.io.*;
class Array_Starter_0___Program_25_
{
public void main()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int ar[]=new int[10];
int i;
System.out.println(" Enter 10 Numbers ");
for(i=0;i<10;i++)
{
ar[i]=Integer.parseInt(br.readLine());
}
int n=ar[0];
for(i=0;i<10;i++)
{
ar[i-1]=ar[i];
}
ar[i-1]=ar[0];
System.out.print(" Output ");
for(i=0;i<10;i++)
{
System.out.print(ar[i]);
}
}
}
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyFri Jan 30, 2009 6:38 pm

its because you have given ar[i-1]=ar[i]

so, when i=0, i-1=-1; which is not in the index oof -1(you have given only from 0 to 9 as index of array ar. so, its Array index out o bounds, it means that the given value is beyond the boundary of the array.
Back to top Go down
arunnambiar1994
Active member
Active member



HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyFri Jan 30, 2009 10:19 pm

HOW TO SOLVE THE PROBLEM
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptySat Jan 31, 2009 4:13 pm

what is the question? this program is to do what?
Back to top Go down
arunnambiar1994
Active member
Active member



HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptySat Jan 31, 2009 8:12 pm

I EXPECTED THIS QUESTION FROM YOU!
THIS WAS OUR COMPUTER PRACTICAL AND IT RAN IN SOME COMPUTER AND DID NOT RUN IN SOME COMPUTER.IS THIS THE PROBLEM OF THE COMPUTER OR THE CODE.OUR TEACHER IS STRANGE AND MAM GAVE THE PROCESS-
for(i=0;i<10;i++)
{
ar[i-1]=ar[i];
}
ar[i-1]=ar[0];
MAM TOLD SIZE 10 OF ARRAY AND FIND THE AIM OF THE PROGRAMME.

WE FOUND OUT THAT THE AIM WAS TO PRINT THE NUMBER ONE LESS THAN THE NUMBER INPUTED.

WHERE IS THE PROBLEM!!! Question
Back to top Go down
Anu..i luv icse...:)
Active member
Active member
Anu..i luv icse...:)


HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyMon Feb 02, 2009 3:21 pm

ok...i'll tell u wat i have understood....

the program is to accept 10 values in an array, and then print one less than the entered values of the array......right?

then it should be....

import java.io.*;
class Array_Starter_0___Program_25_
{
public void main()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int ar[]=new int[10];
int i;
System.out.println(" Enter 10 Numbers ");
for(i=0;i<10;i++)
{
ar[i]=Integer.parseInt(br.readLine());
}
System.out.print(" Output ");
for(i=0;i<10;i++)
{
a[i]=a[i]-1;
System.out.print(ar[i]);
}
}
}

check if this comes right/..
Back to top Go down
arunnambiar1994
Active member
Active member



HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyMon Feb 02, 2009 4:52 pm

THANK YOU IT WORKED!!!
Back to top Go down
ambili
Active member
Active member
ambili


HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyMon Feb 02, 2009 7:15 pm

that's right Exclamation sunny
Back to top Go down
arunnambiar1994
Active member
Active member



HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME EmptyThu Feb 05, 2009 5:13 pm

OK OK O K OK OK OK cheers
Back to top Go down
Sponsored content




HELP ME IN THIS ARRAY PROGRAMME Vide
PostSubject: Re: HELP ME IN THIS ARRAY PROGRAMME HELP ME IN THIS ARRAY PROGRAMME Empty

Back to top Go down

HELP ME IN THIS ARRAY PROGRAMME

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: Computer :: Computer help forum-