CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@safwan • 23 Jan, 2009
HI, all i have made a program to print a pyramid in vb0.6 but its looking like:
*
* *
* * *
* * * *
* * * * *
but i need :
-----*
----* *
---* * *
--* * * *
so my code wich i wrot is
Private Sub Command1_Click()
i = 1
For i = 1 To 5
y = 1
For y = 1 To i
Print "*";
Next y
Print
Next i

End Sub
so plz help what will be the code.
😉

😁
@safwan • 24 Jan, 2009 plese tomorrow is my practical exame for final any body some body just give idea also plese.
@shalini_goel14 • 24 Jan, 2009 Hi safwan,

Please check the following piece of code, if it can be of any help to you.😀

Private Sub Command1_Click()
a = 1
For a = 1 To 5
b = 1 
For b = 1 To 6-a
Print " ";
Next b
c = 1
For c = 1 To a
Print "*";
Next c
Print
Next a
End Sub
 
Please correct me if any syntax errors. Hope this logic will work for you.😀

[Note : The above code is not compiled and executed. So if any issues let me know. ]
@shalini_goel14 • 24 Jan, 2009 Re: Printing pyramid in JAVA

For Java users, Pyramid can be make as follows.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myjava;
/**
 *
 * @author shalinig
 */
public class Pyramid {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
 
        for (int a = 1; a <= 5; a++) {
 
            for (int b = 0; b <= 5-a; b++) {
                System.out.print(" ");
            }
            for (int c = 1; c <= a; c++) {
                System.out.print("* ");
            }
            System.out.print("\n");
        }
    }
}
 
Output:
*same as asked by safwan*

[Note : This code is well compiled and executed. ]
@safwan • 24 Jan, 2009
shalini_goel14
Hi safwan,

Please check the following piece of code, if it can be of any help to you.😀

Private Sub Command1_Click()
a = 1
For a = 1 To 5
b = 1 
For b = 1 To 6-a
Print " ";
Next b
c = 1
For c = 1 To a
Print "*";
Next c
Print
Next a
End Sub
 
Please correct me if any syntax errors. Hope this logic will work for you.😀

[Note : The above code is not compiled and executed. So if any issues let me know. ]
Thank you shalini
10k views

Related Posts

@Rucha Wankhede · Nov 18, 2017

The other day I had to buy a present for my nephew's birthday, and while strolling down the long aisles of toys of the toy store, I couldn't help but...
5.2k views

@shaji.m · Apr 20, 2016

dear sir, please help to get IS875 part3- 2015 version code.
6.1k views

@Ankita Katdare · May 13, 2015

Lenovo India is riding the high wave as it introduces its flagship smartphone called 'Lenovo A7000' in the country. Priced at Rs. 8999, this smartphone is truly a competitor to...
4.2k views

@Ankita Katdare · Dec 23, 2013

The Samsung Galaxy Grand 2 was launched by the Korean company in November and today it if officially unveiling in India. Bigger in size and processing power than it's younger...
4.2k views