package passedfailedgrades; import java.util.Scanner; public class PassedFailedGrades { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int passedCount = 0, failedCount = 0; for (int i = 1; i <= 10; i++) { System.out.print("Enter grade " + i + ": "); int grade = input.nextInt(); if (grade >= 75) { passedCount++; } else { failedCount++; } } System.out.println("Passed: " + passedCount); System.out.println("Failed: " + failedCount); } }
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