please can someone copy & paste the source code for the following:
basically i want to print out the following on the screen:
*
**
***
****
how would i do this???
please can someone copy & paste the source code here??
(btw yes i do mean *'s !!! )
please can someone copy & paste the source code for the following:
basically i want to print out the following on the screen:
*
**
***
****
how would i do this???
please can someone copy & paste the source code here??
(btw yes i do mean *'s !!! )
Let's start from here, what have you tried?
I can't find the file cos someone did this for me but basically that's what I want to try.. basically it's just simple with a a nested for loop and i wanna print that pattern
I don't understand. You know it's a nested for loop, so what exactly is stopping you from analyzing the pattern and doing it? The code you need can be discovered, you just need to persevere. Think about how the outer loop will start the inner loop over, decide what the inner loop needs to do, etc.
if you don't mind please can you just do it for me?? if you have a spare moment or so... i mean please can you just write the source code for me??
cos im just confused.
no, i mean someone told me it's a nested loop
And what would you do if you needed to write a loop and I wasn't available? :-/if you don't mind please can you just do it for me?? if you have a spare moment or so... i mean please can you just write the source code for me??
Well there are lots of different types of loops, but the kind of loop you need is called a counting loop. You can use for loops to do it. The header of the for loop looks like this - for ( start count; count until this number; add to count ) and you loop a set number of instructions, or another loop, like you need to do in the assignment.cos im just confused.
So if you wanted to count from 1 to 5 you could do:
The trick to the assignment is figuring out exactly what you are counting in order to display the shape.Code:for (int i = 1; i <= 5; i++) { // statements }
i just wanna display : *
**
***
****
Whiteflags gave you everything you need,the loop is perfect.
But if you want to do it another way just use printf and finish ....
what would the statements be??
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
Honestly, if you don't have the perseverance to try to learn this simple example for yourself, you have no future in programming. You learn by doing - programming is a long and often difficult journey, and at some point you either have the passion to succeed or you will give up. Someone giving you the answer is meaningless; the real trick to programming is learning how to reach the answer. That's why it's so important to try your best on your own first; if you have problems, others can guide you onto the right thought process to advance.
It would be like showing a chess configuration to a grandmaster and asking what the best move is. If they answered you, what did you learn? You might know an answer to one specific problem, but without understanding the reasoning behind the answer, you didn't learn anything that's useful to any other problem. On the other hand, if you went to the grandmaster, explained what move you would make and why, then actual instruction could happen.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
Its a preety simple answer,i think its a very nice program for beggining a journey into programming.The thing is there are no shortcuts! Have fun!