Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class punto3 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner num= new Scanner (System.in);
- int x,cont=0;
- double prom, suma=0;
- System.out.println("Ingrese un numero positivo");
- x=num.nextInt();
- if(x>0) {
- System.out.println("sus numeros divisores son");
- for (int i=1;i<=x;i++) {
- if(x%i==0) {
- System.out.println(i);
- suma+=i;
- cont++;
- }
- }
- System.out.println("son "+cont+" divisores");
- prom=(suma/cont);
- System.out.println("su promedio es "+prom);
- }
- else {
- System.out.println("no es valido el numero ingresado");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement