Write a qbasic program to display perfect number or not.

ALK
By -
0








Ans:


CLS


INPUT "Enter a number ";n


FOR j=1 TO n-1


       IF n MOD j=0 THEN 


              Sum=Sum+j


       END IF


NEXT j


IF n=Sum THEN


       PRINT "It is perfect number"


ELSE


       PRINT "It is not perfect number"


END IF


END



Post a Comment

0Comments

Feel free to leave your comment below or get in touch with me on WhatsApp/Viber number: +9779844128670

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn more
Ok, Go it!