Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Need the code in Basic Prog language to display the following pattern:

5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
Posted
Comments
Smithers-Jones 14-Jul-10 7:27am    
Ever heard of the little word "please"? (Not to be confused with "pls".)

1 solution

Here you go:

QBasic
10 CLS
20 PRINT "5 4 3 2 1"
30 PRINT "4 3 2 1"
40 PRINT "3 2 1"
50 PRINT "2 1"
60 PRINT "1"
70 END
 
Share this answer
 
Comments
Richard MacCutchan 14-Jul-10 7:43am    
Reason for my vote of 5
Cool! I will use this in my next project.
Nish Nishant 14-Jul-10 8:04am    
I was going to try and give him a more generic version of the program but to my dismay I found that GWBasic won't run on my Windows 7 box because it's 64 bit, and GWBasic is 16 bit :-(

So you'll have to go with the highly optimized but hardly reusable version posted by Smithers-Jones.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900