CS101: COMPUTER PROGRAMMING Lecture 1: Introduction to Computer and Programming.
COMPUTER PROGRAMMING
-
Upload
arisamae1114 -
Category
Technology
-
view
345 -
download
6
Transcript of COMPUTER PROGRAMMING
![Page 1: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/1.jpg)
COMPUTER
PROGRAMMIN
GPREPARED BY:
PAGADUAN, JOANNE A.
VIJUNGCO, ARISA MAE D.
GRADE 9 SSC LAVOISIER
MR. ANGEL CORONA
COMPUTER PROGRAMMING ADVISER
![Page 2: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/2.jpg)
RETRIEVING
KEYBOARD
INPUT FROM
THE USER
![Page 3: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/3.jpg)
INPUT
commandOne way to receive input from the keyboard is with the INPUT command.
Allows the user to enter a string or a number, then stored in a variable.
![Page 4: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/4.jpg)
REMEMBER:
If the program is executed, the INPUT command
displays a question mark, and followed by a
blinking cursor.
TIP:
If you place a string and a semi- colon between
INPUT and the variable, the program will print the
string.
INPUT “Please enter some text:”;
![Page 5: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/5.jpg)
The IF and THEN
command It is used to compare an expression and the
perform some task based on that expression.
x=3
IF x=3 THEN PRINT “x equals to 3”
Since X does equal 3 in this case, the program outputs:
X equals to 3
![Page 6: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/6.jpg)
EXPRESSION
Signs< (less than)
> (greater than)
<> (does not equal)
<= (less than or equal)
>= (more than or equal)
NOTE:
Some signs that can be used instead of = (equal)
sign.
![Page 7: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/7.jpg)
ELS
EIt helps the program to perform different action if the
statement is false.
x=8
If x= 7 THEN PRINT “YES” ELSE PRINT “NO”
Since X doesn’t equal to 8, the output is:
NO
![Page 8: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/8.jpg)
END
IFIt helps you to have multiple
commands after the IF… THEN statement.
They must start on the line after the IF statement.
END IF should appear right after the list of commands.
![Page 9: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/9.jpg)
INPUT “Please enter a number”, x
IF x< 6 THEN
PRINT “YES”
ELSE
PRINT “NO”
END IF
![Page 10: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/10.jpg)
Proceed to next slides for
exercises
Test your
skills!
![Page 11: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/11.jpg)
OBJECTI
VES: TO ENHANCE SKILLS IN COMPUTER PROGRAMMING USING THE
WIDELY KNOWN AND ACCEPTED PROGRAMMING LANGUAGE,
QBASIC.
TO EASILY GRASP THE BASICS OF COMPUTER PROGRAMMING
THROUGH THE USE OF QBASIC.
PROCED
URE: ANSWER THE FOLLOWING EXERCISES THROUGH THE USE OF
QBASIC.
USE QBASIC FOR COMPUTER PROGRAMMING FOR THE EXERCISES
READIED/MADE BY THE PRESENTERS.
![Page 12: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/12.jpg)
EXERCISE 1:
IF- THENPROGRAM
x=143
IF x = 143 THEN PRINT “I LOVE YOU”
PROGRAM
x=333
IF x = 123 THEN PRINT “BLACK”
![Page 13: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/13.jpg)
EXERCISE 2: IF-
THEN ELSEPROGRAM
x = 100
IF x=90 THEN PRINT “LOL” ELSE PRINT “ULOL”
IF x=143 THEN PRINT “HAH” ELSE PRINT “HUH”
IF x<10 THEN PRINT “OKAY” ELSE PRINT “LANG”
IF x>100 THEN PRINT “WHATEVER” ELSE PRINT “TSK”
IF x<> 99 THEN PRINT “MAGANDA” ELSE PRINT “PANGIT”
![Page 14: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/14.jpg)
EXERCISE 3: IF- THEN-
ELSE- END IF
This is about choosing to do either one thing or another (simple
selection). This is a test in the use of the IF instruction. The If instructions
spans many lines and includes four (4) keywords, IF, THEN, ELSE, END IF.
Create a program that will ask you a number. It will then print
out the word KIND. If the number is greater than 50 or the word RUDE if it
is not.
NOTE* Two (2) programs for both outputs.
Instructions:
![Page 15: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/15.jpg)
EXERCIS
E 1PROGRAM
:
OUTPUT:
The output should be
[ I LOVE YOU ]
since the given data satisfied the condition
![Page 16: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/16.jpg)
PROGRA
M: OUTPUT:
The output should be just blank since the given data
did not satisfy the condition.
![Page 17: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/17.jpg)
EXERCISE 2
PROGRAM:
OUTP
UT:
![Page 18: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/18.jpg)
EXERCISE 3PROGRAM:
OUTP
UT:
![Page 19: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/19.jpg)
PRESENTED BY:
PAGADUAN,
JOANNE A.
VIJUNGCO, ARISA
MAE D.
PRESENTED TO:
MR. ANGEL
CORONA
GRADE 9 SSC
VIJUNGCO, ARISA MAE D.PAGADUAN, JOANNE A.
![Page 20: COMPUTER PROGRAMMING](https://reader033.fdocuments.in/reader033/viewer/2022052602/55a965e01a28ab4f108b47f2/html5/thumbnails/20.jpg)
END