Sunday, December 20, 2020

 4.  WRITE AN ALGORITHM TO INPUT 100 NUMBERS AND DISPLAY THE SUM OF 

      FACTORS OF EACH NUMBER.

START

STEP 1 : DECLARE I ,J, C , NUM  AS AN INTEGER

STEP 2: I=1 , NUM=0

STEP 3: INPUT "ENTER THE NUMBER", NUM

STEP 4: J=1 , C=0

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

STEP 6: INCREMENT THE VALUE OF J BY 1

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

STEP 8 : PRINT "SUM OF FACTORS", C

STEP 9: INCREMENT THE VALUE OF I BY 1

STEP 10: IF I<=100 THEN GOTO STEP 3 

END

 3.WRITE AN ALGORITHM TO INPUT 100 NUMBERS AND DISPLAY THE SUM OF EVEN POSITIVE NUMBERS


START

STEP 1 : DECLARE I , C , NUM  AS AN INTEGER

STEP 2: I=1 , C=0 , NUM=0

STEP 3: INPUT "ENTER THE NUMBER", NUM

STEP 4: IF NUM %2=0 AND NUM>0 THEN C=C+NUM

STEP 5: INCREMENT THE VALUE OF I BY 1

STEP 6: IF I<=100 THEN GOTO STEP 3 

STEP 7 : PRINT "SUM OF EVEN POSITIVE NUMBERS", C

END



 2.  WRITE AN ALGORITHM TO INPUT 100 NUMBERS AND DISPLAY THE SUM OF PRIME 

      NUMBERS.

START

STEP 1 : DECLARE I ,J, C , NUM  AS AN INTEGER

STEP 2: I=1 , C=0 , NUM=0

STEP 3: INPUT "ENTER THE NUMBER", NUM

STEP 4: J=1 , K=0

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

STEP 6: INCREMENT THE VALUE OF J BY 1

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

STEP 8 : IF J=2 THEN C=C+NUM

STEP 9: INCREMENT THE VALUE OF I BY 1

STEP 10: IF I<=100 THEN GOTO STEP 3 

STEP 11 : PRINT "SUM OF PRIME NUMBERS", C

END

 1.WRITE AN ALGORITHM TO INPUT 100 NUMBERS AND DISPLAY THE SUM OF ODD NUMBERS


START

STEP 1 : DECLARE I , C , NUM  AS AN INTEGER

STEP 2: I=1 , C=0 , NUM=0

STEP 3: INPUT "ENTER THE NUMBER", NUM

STEP 4: IF NUM %2< >0 THEN C=C+NUM

STEP 5: INCREMENT THE VALUE OF I BY 1

STEP 6: IF I<=100 THEN GOTO STEP 3 

STEP 7 : PRINT "SUM OF ODD NUMBERS", C

END


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