UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 10 de junio de 2015

PROBLEMA 44

44.- OBTENER LA CANTIDAD DE LOS PRIMEROS N NUMEROS MULTIPLOS DE 5.



/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema44cantidaddeprimerosnnumerosmultiplosde5;
import java.util.Scanner;
/**
 *

 */
public class Problema44cantidaddeprimerosnnumerosmultiplosde5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
     int i, n,c=0;
       Scanner teclado=new Scanner(System.in);
       System.out.println("Número: " );
       n=teclado.nextInt();
       i=1;
       while (i<=n)
       {
       if  (i%5==0)
       {    
       c+=1;
       }
       i++;
       
       }       
       System.out.println(" " );
       System.out.println("Cantidad: "+c);

    }
}

No hay comentarios:

Publicar un comentario