Showing posts with label Codes. Show all posts
Showing posts with label Codes. Show all posts

Tuesday, March 2, 2010

GW-Basic Programe to Demonstrate Siren sound

 Here is the Code listing for the GW-Basic Program which demonstrate the siren sounds using SOUND statement along with FOR-NEXT Loop.

Code

10 For R=1 To 8
20 REM *******Rising Pitch *********
30 For F=200 To 400
40 Sound F, 0.1
50 Next F
60 REM *******Decreasing  Pitch *********
70 For J= 400 To 200 Step -2
80 Sound J, 0.1
90 Next J
100 Next R
110 End
Output
 
* This program will generate sound of Siren

GW-Basic Programe to Demonstrate the SOUND

 Here is the Code listing for the GW-Basic Program which demonstrate the different frequencies of sounds using SOUND statement.

Code

10 While 1
20 Sound 256, 9
30 Sound 480, 9
40 Wend

Output
* This program will generate audio sound

Friday, February 19, 2010

Creating a program to Determine the Given Number is either Negative, Zero or Positive

Here is the program to Determine the Given Number is either Negative, Zero or Positive

Code
10 Cls
20 REM TO find the Given Number is -VE, 0 or +ve
30 input "enter a Number"; N
40 A$= "Negative"
50 B$="Zero"
60 C$= "Positive"
70 D$= "The Number is "
80 S=SGN(N)+2
90 On S GOTO 100, 110, 120
100 Print D$; A$ : End 
110 Print D$; B$ : END
120 Print D$; C$ : end
130 End

Output

Enter the number? 4
The Number is Positive

Creating a Big Z on Screen

Here is the program Creating  a Big Z on Screen

Output
                              
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
                                                             zzzzzzz
                                                           zzzzzzz
                                                         zzzzzzz
                                                     zzzzzzz
                                                  zzzzzzz
                                              zzzzzzz
                                          zzzzzzz
                                      zzzzzzz
                                  zzzzzzz
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
                              zzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Monday, February 15, 2010

Creating Two Table for Number Given By User

Program code for Creating Two Table for Two number Given By User:


Codes



10 Input " Enter 1st Number for the Table: ", A
20 Input  Enter 2nd Number: ", B
30 For I =1 To 10 
40 Print A " * " I " =  " A*I TAB(20) B " * " I " =  " B*I
50 Next I
60 END 
 Output
(assume that given numbers are 3 and 4 for output)

3*1=3                            4*1=4
3*2=6                            4*2=8
3*3=9                            4*3=12
3*4=12                          4*4=16
3*5=15                          4*5=20
3*6=18                          4*6=24
3*7=21                          4*7=28
3*8=24                          4*8=32
3*9=27                          4*9=36
3*10=30                        4*10=40


Friday, February 12, 2010

programe to Demonstrate the Read and Data Statements

Here is the gwbasic program to demonstrator the Read and Data statements. Coding is as under:


GW Basic Code 

10 cls
20 Read A,B,C, A$, B$,C$
30 Data 58,70,85
40 Print A$ TAB(20) "  Obtained " ; A ; " Marks"
50 Print B$ TAB(20) "  Obtained " ; B ; " Marks"
60 Print C$ TAB(20) "  Obtained " ; C ; " Marks"
70 Data Tahir, Umar, Tariq
80 End

Output of the Code

Tahir                       Obtained   58 Marks
Umar                      Obtained   70 Marks
Tariq                       Obtained   85 Marks

Wednesday, February 10, 2010

GW Programmer for Creating a Table for any Number

program code for Creating the Table for any number in gwbasic is as under:

Code

10 Input " Enter Number for the Table", A
20 Print " Table for the Number ", A
30 For I =1 To 10 
40 Print A " * " I " =  " A*I
50 Next I
60 END 

Output

(assume that given number is 3 for output)

3*1=3
3*2=6
3*3=9
3*4=12
3*5=15
3*6=18
3*7=21
3*8=24
3*9=27
3*10=30

  © Blogger template 'A Click Apart' by Ourblogtemplates.com 2008

Back to TOP