int TotalEggs = 0, eggsPerChicken = 5, chickenCount = 3; TotalEggs=eggsPerChicken*chickenCount; TotalEggs+=eggsPerChicken*++chickenCount; TotalEggs+=eggsPerChicken*(chickenCount/2); System.out.println(TotalEggs); TotalEggs = 0; eggsPerChicken = 4; chickenCount = 8; TotalEggs=eggsPerChicken*chickenCount; TotalEggs+=eggsPerChicken*++chickenCount; TotalEggs+=eggsPerChicken*(chickenCount/2); System.out.println(TotalEggs); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter