# Thread: can u tell me w/c one is correct?

1. Member
Join Date
Oct 2012
Posts
10
Rep Power
0

## can u tell me w/c one is correct?

im trying to figure out w/c one displays the largest number among the individual digits of my input.
cuz im using windows now cant run them.

Java Code:
import java.util.Scanner;
class Largest{
public static void main(String args[]){
Scanner x = new Scanner(System.in);
int value = -1;
int counter = 0;
do{
System.out.println(Enter an integer:");
int tmp = x.nextInt();
if (tmp > value)
value = tmp;
counter++;
}while (counter < 5);
System.out.println("Largest interger entered was >>" + value);
}
}

this is the second one:

Java Code:
import java.util.Scanner;
class Largest{
public static void main(String args[]){
Scanner i = new Scanner(System.in);
int r = 0;
int q = 0;
int n = 0;
int larger = 0;
System.out.println("Enter input:");
n = i.nextInt();
for (q<10;){
q = n/10;
r = n%10;
System.out.println("Quotient:" + q);
System.out.println("Remainder:" + r);
larger = Math.max(q, r);
}
System.out.println("The larger number is:" + larger);
}
}

2. ## Re: can u tell me w/c one is correct?

Originally Posted by akocnivek
im trying to figure out w/c one displays the largest number among the individual digits of my input.
What's w, and what's c? I don't see either as a variable name in your code. Not that the sentence makes any sense even if they did exist.

db

3. Member
Join Date
Oct 2012
Posts
10
Rep Power
0

## Re: can u tell me w/c one is correct?

i mean which one displays the largest number among the individual digits of my input.
:D
w/c = which

4. Member
Join Date
Mar 2012
Posts
29
Rep Power
0

## Re: can u tell me w/c one is correct?

both of them have syntax errors here's an online compiler, if you can't run it on your windows for some reason, Ideone.com | Online IDE & Debugging Tool >> C/C++, Java, PHP, Python, Perl and 40+ compilers and interpreters if you don't trust the link then google one...once you get the programs to work you can test both of them see which one works better for you
Last edited by romero4742; 10-21-2012 at 09:01 AM. Reason: url correction

5. ## Re: can u tell me w/c one is correct?

Originally Posted by akocnivek
w/c = which
Please use proper words. This is a technical forum, not SMS chat.

db

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•