#easy problem

1 messages · Page 1 of 1 (latest)

gleaming pawn
#

I need to enter a 3 digit number and check if it has at least two numbers that are the same ex: 232 > it has

undone merlinBOT
#

Hey, @gleaming pawn!
Please remember to /close this post once your question has been answered!

winged moth
#

Okay?

gleaming pawn
#

how do i do that?

#

😅

winged moth
#

You want people to do your work?

gleaming pawn
#

nope

#

i just need help with that

winged moth
#

Well, what is the moment when you start needing help?

#

And it is a problem that you didn't explain that moment at your first post

gleaming pawn
#

wdym

#

what is this attitude im not looking for someone to do my work smh

#

im looking for help

#

im learning by myself

winged moth
#

You're saying you're looking for help, and you haven't even showed what are the parts you don't know how to do

gleaming pawn
#

i tried to figure it out for an hour

winged moth
#

Still not saying what are the parts you don't know how to do

#

We've all been beginners. I've never been someone who would tell others: "Here is a problem. How to do it?"

#

So, be like me

frozen bobcat
#

Think how you would do this on paper not using a computer.

Would you treat it as a number? Are there some numbers that are 3 digits and some that are not? Are there rules we can use to say if a number has 3 digits or not?

winged moth
#

(When they can't tell what's stopping them, they usually don't know how to read a number in the first place and therefore that it would be assigned to an int value.
And when they say they worked for an hour but don't show the class skeleton, they don't know how to make a class and haven't done anything.
Just general info on where people usually here at if you want to guide them)

frozen bobcat
gleaming pawn
#

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please enter a three digits number");
        int num = scanner.nextInt();
        int units = num % 10;
        //   System.out.println(units);
        int tens = (num / 10) % 10;
        // System.out.println(tens);
        int hundreds = num / 100;
        //   System.out.println(hundreds);

        if (units == hundreds)
            System.out.println("your duplicated number is: " + units);
        else if (units == tens) {
            System.out.println("your duplicated number is: " + units);
        } else if (tens == hundreds) {
            System.out.println("your duplicated number is: " + tens);
        } else System.out.println("You have no duplicated numbers");

    }
}```
#

solved

#

@winged moth

winged moth
#

Glad for you but you still didn't do anything that could enable to help you.
I can't know whether you finally decided to work or whether you convinced someone else to write this for you, but at the end of the day, the bigger point is you need to describe your situation when you're in need for help

gleaming pawn
#

i did it myself

#

learn to give compliments

winged moth
#

I know to give compliments. I don't know to verify whether you actually did it yourself

#

This doesn't account for how a number should be 3 digits. Can you modify it so that it gives an error message rather than study the digits, if it is not 3 digits?

gleaming pawn
#

-_-

#

what did you say

onyx field
#

hello

#

we save others time

#

thats how we grow as community

onyx field
gleaming pawn
onyx field
gleaming pawn
#

can you fix this i dont see an error

#

sorry

onyx field
#

i didnt meant like that lol by trial and error i mean example u have to find
x+y=3
x-y=1
u first guess meaning u do trial so u guess x = 1 or something
then y have to be 2 but it wont work in second equation then u guess x = 2 and y =1 and it working in both but see guess waists time thats why we do systematic approach

#

like systematic approach for this linear equation in 2 variable is substitution method

winged moth
onyx field
winged moth
#

And why would you do that?

novel mantle
#

as for the so called "attitude", that isn not attitude, that is just someone pointing out that we're not here to spoon feed code to you :)