program main
IMPLICIT none
    INTEGER :: a,b,C=0,i,s=0,X=0
    PRINT *,"ENTER A NUMBER"
    read *,a
    DO I=1,A/2
    if(mod(a,i)==0) C=C+1
    ENDDO
    IF(C==1) THEN 
    PRINT *,"PRIME NUMBER"
    ELSE 
    DO I=1,A/2
    if(mod(a,i)==0) S=S+I
    ENDDO
    IF(S==A) THEN
    PRINT *,"PERFECT NUMBER"
    ELSE
    PRINT *,"COMPOSITE NUMBER"
    ENDIF
    ENDIF
END program main

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: