Download program 1 rem program to find the sum and product of two numbers

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Location arithmetic wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Arithmetic wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Halting problem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Addition wikipedia , lookup

Transcript
PROGRAM 1
REM PROGRAM TO FIND THE SUM AND PRODUCT OF TWO NUMBERS
PRINT "ENTER ANY TWO NUMBERS IN THE FORM A,B"
INPUT A, B
PRINT "SUM OF A AND B IS: "; A + B
PRINT "PRODUCT OFA AND B IS: "; A * B
END
PROGRAM 2
REM TO ACCEPT VALUES OF TWO NUMBERS AND INTERCHANGE THEIR VALUES
PRINT "ENTER ANY TWO NUMBERS IN THE FORM A, B"
INPUT A, B
LET C = B
B=A
A=C
PRINT "THE INTERCHANGED VALUES OF A AND B ARE: "; A, B
END
PROGRAM 3
REM TO PRINT AREA AND CIRCUMFERENCE OF A CIRCLE
INPUT "Enter the radius of the circle in cm: "; Radius
REM Area of a circle is 3.14 * r * r
Area = 3.14 * Radius * Radius
Circumference = 2 * 3.14 * Radius
PRINT "Area and circumference of Circle with radius "; Radius; "are "; Area; "and "; Circumference; "respectively."
END
PROGRAM 4
REM To find the number of days, a driver will cover a distance of 2800 km if speed is 50 km / hr
LET Speed = 50
Distance = 2800
REM Time= (Distance / Speed) * 1/24 for number of days.
PRINT " The number of days taken by the driver is: "; (Distance / (Speed * 24))
END
PROGRAM 5
REM To find the sum of first 100 natural numbers
10 LET Num = 1
20 Sum = 0
30 IF Num <= 100 THEN GOTO 40 ELSE GOTO 70
40 Sum = Sum + Num
50 Num = Num + 1
60 GOTO 30
70 PRINT " Sum of first 100 Natural numbers is: "; Sum
80 END
PROGRAM 6
REM To input a number and find whether it is positive or negative
10 CLS
20 INPUT "ENTER A NUMBER "; NUM
30 IF NUM < 0 THEN
40 PRINT "ENTERED NUMBER IS A NEGATIVE NUMBER"
50 ELSEIF NUM = 0 THEN
60 PRINT "ENTERED NUMBER IS ZERO"
70 ELSE PRINT "ENTERED NUMBER IS A POSITIVE NUMBER"
80 END IF
90 END
PROGRAM 7
REM To print the sum of first 10 even numbers
10 LET Num = 1
20 Sum = 0
30 IF Num <= 10 THEN GOTO 40 ELSE GOTO 80
40 Even = Even + 2
50 Sum = Sum + Even
60 Num = Num + 1
70 GOTO 30
80 PRINT " Sum of first 10 even numbers is: "; Sum
90 END
PROGRAM 8
REM To print the product of two numbers only if the product exceeds 400
10 CLS
20 INPUT "ENTER TWO NUMBERS IN THE FORM A,B "; A, B
30 Product = A * B
40 IF Product > 400 THEN GOTO 50 ELSE GOTO 70
50 PRINT "PRODUCT OF A AND B IS: "; Product
60 GOTO 80
70 PRINT "Product is less than 400."
80 END
PROGRAM 9
REM To print the odd numbers between 500 to 1000
10 LET Num = 501
20 IF Num <= 999 THEN GOTO 30 ELSE GOTO 60
30 PRINT Num;
40 Num = Num + 2
50 GOTO 20
60 END
PROGRAM 10
REM TO INPUT TWO NUMBERS AND DEPENDING UPON THE USERS CHOICE, ADD, SUBTRACT, MULTIPLY OR DIVIDE
THE NUMBERS
10 PRINT "Enter two numbers : "
20 INPUT First
30 INPUT Second
40 PRINT "Press '1' for Addition, '2' for Subtraction, '3 ' for Multiply and '4' for Divide "
50 PRINT "Enter your choice: "
60 INPUT Ch
70 LET Result = 0
80 IF Ch = 1 THEN Result = First + Second
90 IF Ch = 2 THEN Result = First - Second
100 IF Ch = 3 THEN Result = First * Second
110 IF Ch = 4 THEN Result = First / Second
120 PRINT "Solution of your entered choice is: "; Result
130 END
PROGRAM 11
REM TO PRINT THE SERIES 2,5,10,17 ... 101. THE LOOP SHOULD RUN FOR 10 TIMES
10 LET N = 1
20 NUM = 2
30 IF NUM <= 101 THEN GOTO 40 ELSE GOTO 80
40 PRINT NUM;
50 N = N + 1
60 NUM = NUM + (2 * N - 1)
70 GOTO 30
80 END
PROGRAM 12
REM TO DISPLAY PERCENTAGE OF MARKS SCORED BY STUDENTS AND REMARKS
10 INPUT "MATHS: "; M
20 INPUT "COMPUTER: "; C
30 INPUT "ENGLISH: "; E
40 INPUT "SCIENCE: "; S
50 INPUT "HINDI: "; H
60 INPUT "TOTAL MARKS: "; TM
70 SUM = M + C + E + S + H
80 PER = (SUM / TM) * 100
90 IF PER > 80 THEN
100 PRINT PER; "% - GOOD PERFORMANCE..!"
110 ELSE PRINT PER; "% - AVERAGE PERFORMANCE."
120 END IF
130 END