Friday, November 13, 2020

 

1. TO INPUT 'N' DIFFERENT  NUMBERS AND DISPLAY ONLY PRIME NUMBERS.


START 

STEP 1: DECLARE THE VARIABLES  K, J , C ,N AND NUM  AS INTEGER

STEP 2: J=1 , C=0 , NUM=0 , N=0 , K=1

STEP 3: INPUT " HOW MANY NUMBERS:" ; N

STEP 4: INPUT "ENTER THE NUMBER" ; NUM

STEP 5 : IF NUM % J =0 THEN C=C+1

STEP 6 : INCREMENT THE VALUE OF J BY 1

STEP 7: IF J<=NUM THEN GOTO STEP 5 ELSE GOTO STEP 8

STEP 8 : IF C=2 THEN PRINT NUM ; "IS PRIME"

STEP 9 : C=0 , J=1

STEP 10 : INCREMENT THE VALUE OF K BY 1

STEP 11: IF K<=N THEN GOTO STEP 4 

END

 

 




2 comments:

  3.WAP IN JAVA TO INPUT THREE NUMBERS AND COUNT HOW MANY OF THEM ARE EVEN .   import java.util.*; class Prog {   public static ...