Lesson 4 of 34
Operators: गणित करना
8 min 20 XP
Java में + - * / % operators हैं। ध्यान दें: दो ints को / से भाग देने पर पूर्ण संख्या मिलती है और दशमलव भाग हट जाता है। % शेषफल देता है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.दशमलव उत्तर चाहिए तो (double) से cast करें। x += 5, x = x + 5 का छोटा रूप है। x++ एक जोड़ता है और x-- एक घटाता है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.printf("%.2f%n", value) दो दशमलव स्थानों तक print करता है। %n का अर्थ है नई लाइन।