Lesson 4 of 34
Operators: கணக்கீடுகள்Operators: Doing Maths
8 min 20 XP
Java-ல் + - * / % operators உள்ளன. கவனம்: இரண்டு int-களை வகுத்தால் (/) விடை முழு எண் மட்டுமே, தசமப் பகுதி நீக்கப்படும். % மீதியை (remainder) தரும்.
Java has the + - * / % operators. Careful: dividing two ints with / gives a whole number and drops the decimal part. % gives the remainder.
Example: edit me and press Run
Press Run to see the result here.தசம விடை வேண்டுமெனில் (double) என்று cast செய்யுங்கள். x += 5 என்பது x = x + 5 என்பதன் சுருக்கம். x++ ஒன்றைக் கூட்டும், x-- ஒன்றைக் குறைக்கும்.
Cast with (double) when you need a decimal answer. x += 5 is short for x = x + 5. x++ adds one and x-- subtracts one.
Example: edit me and press Run
Press Run to see the result here.printf("%.2f%n", value) இரண்டு தசம இடங்களுடன் print செய்யும். %n என்பது புதிய வரி.
printf("%.2f%n", value) prints with two decimal places. %n means a new line.