1 CLS
2 PRINT "Please to tell me the length of the side of the square."
3 INPUT S
4 PRINT
5 PRINT "The perimeter of the square is "; 4 * S
6 PRINT
7 PRINT "The area of the square is "; S ^ 2
8 PRINT
9 PRINT "That was truly a total blast. Would you like to play again ? 'Y' or 'N' ."
10 INPUT A$
11 IF A$ = "Y" or A$ = "y" then PRINT "Goody! " : GOTO 2
12 IF A$ = "N" or A$ = "n" then PRINT "Well OK then. Goodbye": END
13 PRINT: PRINT "Please to type a 'Y' to play again, or a 'N' to quit for now."
14 GOTO 10
PRINT "Give me the rectangle's length.": Input L PRINT "Give me the rectangle's width.": Input W PRINT "The rectangle's area is "; L x W PRINT "The rectangle's perimeter is "; 2 x (L + W) PRINT "You've been a great audience. I'm here til Thursday. Don't forget to tip your waiter. Have a nice day."
cls input "enter a no"; num if num mod 14= num then print "no is divisible" else print "not divisible" end if end
In BASIC: 10 INPUT X: IF X = 999 THEN STOP ELSE PRINT X; 20 IF X/2 = INT(X/2) THEN PRINT "EVEN" ELSE PRINT "ODD" 30 GOTO 10
Area of any circle = pi*radius squared
If you are referring to this in terms of programming, then let's say I built a pgm that will prompt you to input an integer and my pgm will return the square of your "input"Looks like this:Enter a number and I will square it: 1212 squared = 144Here it is in C++ //input-output stream STL //to make sure i dont need to reinvent the wheelint input_number; //allocate memory for the inputint square; //same for the outputint main{cout >input_number;square = input_number^2;cout
PRINT "Give me the rectangle's length.": Input L PRINT "Give me the rectangle's width.": Input W PRINT "The rectangle's area is "; L x W PRINT "The rectangle's perimeter is "; 2 x (L + W) PRINT "You've been a great audience. I'm here til Thursday. Don't forget to tip your waiter. Have a nice day."
Input "enter name" ;n$ input "enter marks" ; m ifm > 40 then print n$, "pass" else print n$, "fail"
CLS PRINT "PROGRAM: Calculate both perimeter/area of rectangle" PRINT INPUT " Length"; length INPUT "Breadth"; breadth PRINT PRINT "Perimeter: "; 2 * (length + breadth) PRINT " Area: "; length * breadth END
cls input "enter a no"; num if num mod 14= num then print "no is divisible" else print "not divisible" end if end
(Uses Square Root Function) PRINT "Ax^2 + Bx + C = 0" INPUT "A = ", A INPUT "B = ", B INPUT "C = ", C D = B * B - 4 * A * C IF D > 0 THEN DS = SQR(D) PRINT "REAL ROOTS:", (-B - D) / (2 * A), (-B + D) / (2 * A) ELSE IF D = 0 THEN PRINT "DUPLICATE ROOT:", (-B) / (2 * A) ELSE DS = SQR(-D) PRINT "COMPLEX CONJUGATE ROOTS:", (-B / (2 * A)); "+/-"; DS / (2 * A); "i" END IF END IF
(ab)*b
hhh
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
10 cls 20 input"enter word";word$ 30 print word$ 40 print len(word$) 50 end this program is for GW BASIC for other BASIC's the line numbers are optional.
vowels$ = "aeiou" CLS PRINT "PROGRAM: Find if letter is a vowel or not" PRINT INPUT "Type a single alphabet letter: (a-z)/and, then, press Enter key"; aLetter$ PRINT PRINT "Letter "; aLetter$; IF INSTR(vowels$, LCASE$(aLetter$)) THEN PRINT " is a vowel." ELSE PRINT " is NOT a vowel." END
input price calc tip = price*0.15 print tip
a triangle then a square :)