princess5427
| Subject: plz help me asap Tue Aug 18, 2009 6:59 pm | |
| write a program 2 accept 2 no.s & print all th no.s btwn d 2 in reverse order!! plz help asap!!!!! |
|
Boris Active member
| Subject: Re: plz help me asap Tue Aug 18, 2009 10:18 pm | |
| import java.io.*; class revnos { public static void main (String args[]) throws IOException { InputStreamReader x=new InputStreamReader(System.in); BufferedReader y=new BufferedReader(x);
System.out.println("Input First no.(upper limit)"); int n=Integer.parseInt(y.readLine());
System.out.println("Input Second no.(lower limit)"); int m=Integer.parseInt(y.readLine());
for(int a=n;a>=m;a--) { System.out.println(a); } } } |
|
Boris Active member
| Subject: Re: plz help me asap Tue Aug 18, 2009 10:22 pm | |
| hey if u doesn't know whether d user has 1st entered d upper limit or d lower limit den jst add a chk b4 d loop 2 chk which no. is greater nd accordingly change d program... |
|
princess5427
| Subject: Re: plz help me asap Wed Aug 19, 2009 4:41 pm | |
| thank u sooo much boris!!!!! :D:D:D:D:D:D:D |
|
princess5427
| Subject: Re: plz help me asap Wed Aug 19, 2009 11:46 pm | |
| import java.io.*; class murach { public static void main(String [] args)throws IOException { int n,i; String data; InputStreamReader instream = new InputStreamReader (System.in); BufferedReader stdin = new BufferedReader (instream); System.out.println("enter first no."); data=stdin.readLine; n=Integer.parseInt(data); System.out.println("enter second no."); data=stdin.readLine; i=Integer.parseInt(data); for ( int i=1; i=>n; i++) if(n%i==0) System.out.println(+i); } }
wtz d prob here?????????????? |
|
princess5427
| Subject: Re: plz help me asap Wed Aug 19, 2009 11:47 pm | |
| plzzzzzzzzzzzz help!!!!!!!!!!!!!!!!! |
|
PrincessP
| Subject: Re: plz help me asap Sat Aug 22, 2009 1:20 pm | |
| Hey Princess5427! I think this program should sort out ur problem...try it...
import java.io.*; class Reverse_numbers { public static void main() throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the first number: "); int n1=Integer.parseInt(in.readLine());
System.out.println("Enter the second number: "); int n2=Integer.parseInt(in.readLine()); if(n1<n2) for(int i=n2;i>=n1;i--) System.out.println(i); else for(int j=n1;j>=n2;j--) System.out.println(j); } } |
|
Sponsored content
| Subject: Re: plz help me asap | |
|
|
|