Pr0gramer

Filtro de piezas aptas

Jul 31st, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. package piezas_aptas;
  2.     import java.util.Scanner;
  3. public class Piezas_aptas {
  4.     public static void main(String[] args) {
  5.     Scanner keyboard = new Scanner(System.in);
  6.     int x=1, cantidad=0, n;
  7.     float largo;
  8.     System.out.println("Cuantas piecas procesara?");
  9.     n=keyboard.nextInt();
  10.     while (x<=n) {
  11.         System.out.println("Ingrese la medida de la pieza:");
  12.         largo=keyboard.nextInt();
  13.         if (largo>= 1.20 && largo <= 1.30){
  14.             cantidad = cantidad + 1;
  15.         }
  16.         x = x +1;
  17.     }
  18.     System.out.printf("La cantidad de piezas aptas son: %d\n", cantidad);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment