Q BASIC PROGRAMMING CODES
1)Write a program to enter your name, city, country, age and print them.
CLS
Input " Enter the name ";N$
Input " Enter the city";C$
Input " Enter the country";CO$
Input " Enter the age";A$
Print " The name is ";N$
Print " The city is ";C$
Print " The country is ";CO$
Print " The age is ";A$
End
2)Write a program to find the area of rectangle.
Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
let A = l*b
Print" the area of rectangle=" ;a
End
3)Write a program to find the area of the triangle.
Cls
Input " enter the base" ;b
Input " enter the height" ;h
let T = 1/2*b*h
Print" The area of triangle=" ;T
End
4)Write a program to find the area of the circle.
Cls
Input" Enter the radius " ;R
Let C=22/7*R^2
Print " The area of circle =" ;C
End
5)Write a program to find the area of the square.
Cls
Input" Enter the number" ;n
Let square= n^2
Print" The area of square=" ;Square
End
6)Write a program to enter any three numbers,sum and the average.
Cls
Input " Enter any number" ;A
Input " Enter any number" ;B
Input " Enter any number" ;C
Let Sum = A+B+C
Let Average =Sum/3
Print" The sum=" ;Sum
Print" The Average is " ;Average
End
7)Write a program to find the average of three different numbers.
Cls
Input" Enter the number " ;A
Input" Enter the number " ;B
Input" Enter the number " ;C
Let Avg= (A+B+C)/3
Print" The average=" ;Avg
End
8)Write a program to input student's name,marks obtained in four different subjects,find the total and average marks.
Cls
Input" Enter the name " ;N$
Input" Enter the marks in English" ;E
Input" Enter the marks in Maths" ;M
Input" Enter the marks in chemistry" ;C
Input" Enter the marks in physics" ;P
Let S=E+M+C+P
Let A=S/4
Print " The name of the student is" ;N$
Print " The total marks is" ;S
Print " The Average marks" ;A
End
9)Generate the following numbers using For….Next…..Loop.
1,2,3,4,…,50
CLS
For I = 1 to 50 Step 1
Print I
Next I
End
Nested to the nest
FOR I = 1 TO 8
FOR J = 1 TO I
PRINT "5";
NEXT J
NEXT I
This program decrypts NCSA passwords. The file where user names and passwords are stored is called ftppass. The username is the first word on the line, then a colon and the encrypted password. Here's an example:user:ucetcr&'()Run this program and enter the encrypted password, then right after you hit enter, there should be a few linesthat start with encrypted password: and a bunch of garbage, one line (usually the first) will have a word, thats the password for that account.Here's the code:
CLS
SCREEN 12
COLOR 10
REM NCSA Decrypter
INPUT "Encrypted password:"; I$
FOR X = 1 TO 255
FOR Y = 1 TO LEN(I$)
Y$ = MID$(I$, Y, 1)
YA = ASC(Y$)
N = X XOR YA
IF N = 32 THEN F = 1
N$ = N$ + CHR$(N)
NEXT Y
IF F THEN PRINT "Possible password:"; N$
N$ = "": F = 0
NEXT X
PRINT "Finished."
SLEEP 2
END
11) Rem Write any number and find it's half.
Cls
Input "Enter the desired number "; N
Let H = N/2
Print "The half of the number = ";H
END
Comments
Post a Comment