Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Please explain what "doesn't work" means.it doesn't work
The code does not have any print statements to show the results or to prompt the user to enter the number.
If you don't understand my answer, don't ignore it, ask a question.
Aba lino (July 18th, 2021)
Last edited by Mounkaila144; July 16th, 2021 at 11:24 AM.
Please explain what you do and what the program does. What is printed out?it doesn't work when i entered decimal
There could be many reasons why code does not work.
Are decimal points represented by a . or by a , on your computer?
If you don't understand my answer, don't ignore it, ask a question.
[QUOTE=Mounkaila144;172218]hello
[code=Java] public static void main(String[] args) {
Scanner sc=new Scanner(System.in ); //(import java.util.Scanner before public static void main
double n=sc.nextDouble();
System.out.println(n);
}
}
Last edited by parth31; July 18th, 2021 at 06:17 AM.
@parth31
What happens when you compile the code you posted? Are there errors?
Please test your code before posting it.
If you don't understand my answer, don't ignore it, ask a question.
now run the code. there is no errors right now .
if you are interested in pair programming then E mail me at parthmishra1131@gmail.com
Where is the print statement to ask the user to enter a number?
How is your code different from the code in post#3?
If you don't understand my answer, don't ignore it, ask a question.
oh , you want take input from user .
wait then .
Scanner sc = new Scanner (System.in);
System.out.println(" enter your decimal number ");
double number = sc.nextDouble();
System.out.println = (number);
// norm , program #3 is also right . i think i missed to see it .
// Go with anyone both are kindly similar .
Also note that post#3 used code tags which you have not used with your code.
If you don't understand my answer, don't ignore it, ask a question.
like? can you please elaborate...
Look at post#3 to see how the code is formatted.
If you don't understand my answer, don't ignore it, ask a question.
now its totally upto you, i write the code in easy way as easy i can write.
I don't understand why you are posting on this thread instead of working on the thread that you started.
If you don't understand my answer, don't ignore it, ask a question.