2- TOPSHIRIQ
MUKAMMAL SON
package alif;
import java.util.Scanner;
public class Alif {
public static void main(String[] args) {
Scanner kirit=new Scanner(System.in);
int n,b=0;
System.out.print("n="); n=kirit.nextInt();
if(n==1)System.out.println("mukammal son emas");
if(n>1&&n<=1000){
for(int j=2;j<=n;j++){for(int i=1;i<=j/2; i++) {if(j%i==0)b+=i;}
if(b==j) System.out.print(b+"\n"); b=0;}
}
else System.out.print(“ noto’g’ri son kiritdingiz”);
}
Do'stlaringiz bilan baham: |