Advertisement
mmayoub

Ex03, 19.06.2021

Jun 20th, 2021
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ex03 {
  4.     public static void main(String[] args) {
  5.         Scanner in = new Scanner(System.in);
  6.         int y;
  7.         int c = 0;
  8.  
  9.         System.out.print("Enter your grade (0 to 100): ");
  10.         y = in.nextInt();
  11.  
  12.         while (y >= 0 && y <= 100) {
  13.             c++;
  14.  
  15.             System.out.print("Enter your grade (0 to 100): ");
  16.             y = in.nextInt();
  17.         }
  18.  
  19.         System.out.println("You have " + c + " grades");
  20.  
  21.         in.close();
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement