Wednesday, November 18, 2020
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
Thursday, November 12, 2020
1. TO INPUT 20 NUMBERS AND DISPLAY THEIR SUM .
START
STEP 1: DECLARE THE VARIABLES J , C AND NUM AS INTEGER
STEP 2: J=1 , C=0 , NUM=0
STEP 3: INPUT "ENTER THE VALUE OF NUMBER"; NUM
STEP 4: C=C+NUM
STEP 5: INCREAMENT THE VALUE OF J BY 1
STEP 6: IF J<=NUM THEN GOTO STEP 3 ELSE GOTO STEP 7
STEP 7 :PRINT "SUM IS:" ; C
END
ALGORITHM :
-------------------------
1. TO INPUT A NUMBER AND CHECK WHETHER A NUMBER IS PRIME NUMBER OR NOT.
START
STEP 1: DECLARE THE VARIABLES J , C AND NUM AS INTEGER
STEP 2: J=1 , C=0 , NUM=0
STEP 3: INPUT "ENTER THE VALUE OF NUMBER"; NUM
STEP 4: IF NUM % J=0 THEN C=C+1
STEP 5: INCREAMENT THE VALUE OF J BY 1
STEP 6: IF J<=NUM THEN GOTO STEP 4 ELSE GOTO STEP 7
STEP 7 : IF C=2 THEN PRINT NUM; "IS PRIME " ELSE PRINT NUM ; "IS NOT PRIME"
END
3.WAP IN JAVA TO INPUT THREE NUMBERS AND COUNT HOW MANY OF THEM ARE EVEN . import java.util.*; class Prog { public static ...
-
Input a number and check whether the number is Prime or not.
-
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 ...