java - Why is every System.out.println I do failed? -
every system.out.println
fails multiple errors. trying have input 5 integers "please enter 5 integers" showing up.
here have.
import java.util.scanner; public class simplemath { public static void main(string args[]) { scanner user_input = new scanner( system.in ); system.out.println (“ please enter 5 integers. ”); int firstnumber = user_input.nextint(); int secondnumber = user_input.nextint(); int thirdnumber = user_input.nextint(); int fourthnumber = user_input.nextint(); int fifthnumber = user_input.nextint();
okay! using mac cause i'm out of state, here updated version of code, i'm brand new beginning coder, literally took me 20 hours do, , have no idea why quotes on mac keyboard curly can't find straight quotes.
so here update better code source.
import java.util.scanner; public class simplemath { public static void main(string args[]) { scanner user_input = new scanner( system.in ); int firstnumber = user_input.nextint(); int secondnumber = user_input.nextint(); int thirdnumber = user_input.nextint(); int fourthnumber = user_input.nextint(); int fifthnumber = user_input.nextint(); int sixthnumber; int seventhnumber; int eighthnumber; sixthnumber = firstnumber + secondnumber + thirdnumber + fourthnumber + fifthnumber; sixthnumber /= 5; system.out.println ( sixthnumber ); // adding first second third fourth , fifth numbers dividing 5 find mean seventhnumber = firstnumber /= secondnumber; system.out.println ( seventhnumber ); // first divided second number quotient eighthnumber = fourthnumber %= fifthnumber; system.out.println ( eighthnumber ); // fourth divided fifth number remainder } }
you're using wrong type of quote characters. string literals need quoted using regular/straight double quotes ("
) instead of curly/smart quotes (”
).
also, int
should not capitalized. it's either int
(primitive) or integer
(wrapper type).
Comments
Post a Comment