basic programs.ppt

13
Basic Programs Presentation given by Sayantani Ghosh

Upload: sayantani-ghosh

Post on 08-Nov-2015

10 views

Category:

Documents


0 download

DESCRIPTION

a basic idea about programming and also helps to understand many functions

TRANSCRIPT

  • Basic ProgramsPresentation given bySayantani Ghosh

  • Name the basic commandsMODINT( )Conditional Transfer( IF-THEN-ELSE)CHR$( )SQR( )ABS( )ASC( )STR$( )Locate

  • MODMOD MOD operation is used to find out the remainder of something.Syntax : Numeric Variable= MOD Example: 10 LET A=5 20 LET B=2 30 LET R=A MOD B 40 PRINT R 50 ENDRUNOutput is 1

  • INT1.What is the use of INT function?Ans: INT function I used to find out the greatest integer, less than to its argument.Syntax : =INTExample: 10 CLS 20 INPUT ENTER 2 DECIMAL NUMBERS;A,B 30 LET P=INT(A) 40 LET Q=INT(B) 50 LET S=P+Q 60 PRINT S 70 END

  • Conditional Transfer Q. What is the use of IF-THEN-ELSE Statement?Ans: IF-THEN-ELSE is a Conditional Transfer Statement where the program proceeds further only after checking the condition specified in the statement.Syntax : Line No. IFTHENELSEExample:10 CLS 20 INPUT Enter any numbers;N 30 LET R=N MOD 2 40 IF R=O THEN PRINT EVEN ELSE PRINT ODD 50 END

  • VAL( ) Q. What is the use of VAL( ) Function?Ans: VAL( ) function helps us to convert a string to a number if theat string consists only a number or starting with a number.Syntax :Line Number Numeric Variable=VAL(String)Example:10 LET A$=144 Is a gross 20 LET N=VAL(A$) 30 PRINT N 40 ENDRUNOutput is 144

  • CHR$CHR$( ): CHR$( ) is used to find out the character (ASCII) value of a number.ASCII Value65-90:A to Z97-122:a to z48-57:0 to 9Syntax : String Variable= CHR$(Number)Example: 10 CLS 20 INPUT Enter any number between 65 to 90;N 30 LET A$=CHR$(N) 40 PRINT A$ 50 END

  • SQR( ) Q. What is the use of SQR( ) function?Ans: SQR( ) function is used to find out the squareroot value of a number.16 - 16= 4 x 4 =4Syntax: Line Number Numeric Variable= SQR( Number)Example:10 LET N=420 LET A=SQR(N)30 PRINT Square root is; B40 ENDRUNOutput: Square root is 2

  • ABS( ) Q. What is the purpose of ABS( ) function?Ans: ABS( ) function is used to convert a negative number to its positive value but if the number is positive then it will remain positive.Syntax :Line number Numeric Variable=ABS(Numeric Variable)Example:10 CLS 20 LET A= -2 30 LET B=ABS(A) 40 PRINT B 50 ENDOutput is 2

  • ASC( ) Q. What is the use of ASC( ) function?Ans: ASC( ) function is used to find out ACSII value of a character.Syntax :Line Number Numeric Variable=ASC(String Variable)Example:10 CLS 20 LET A$=A 30 LET C=ACS(A$) 40 PRINT C 50 ENDOutput is 90

  • STR$ Q.1 What is STR$( )?Ans: Function STR$( ) is used to store a number as a string.Syntax : Line number String Variable=STR$(Numeric Variable)Example: 10 LET N=25 20 LET A$=STR$(N) 30 PRINT A$ 40 ENDOutput: 25 Q.2 Write the difference between CHR$( ) and STR$( ).

    )

  • Locate Q. What is the use of Locate Statement?Ans: Using Locate Statement we can take the control to a particular position of the screen.Syntax : Line number Locate Row number , Column numberExample: 10 LET A=20 20 LOCATE 14,30 30 PRINT A 40 ENDOutput : 20

  • THANK YOU