printf("Insert a letter -> ");scanf("%c",&lett);printf("Insert a number -> ");scanf("%d",&n);printf("A Triangle will be designed with the '%c' letter composing it, and of %d lines \n",lett,n);int g=0;for(i=1;i<=n;i++) {//for ()g=i;while(g){printf("%c",lett);--g;}

printf("\n"); }

//system("PAUSE");return 0;}

"I'm going to get into your sister. I'm going to get my hands on your daughter." ~Gatito

Go there and follow all the tutorials one at a time and understand each one. Recursion is the one you want to understand the most for this. But you must read about loops and basic syntax before you begin to think about recursion. Good luck!

by AscaL on Wed Oct 27, 2010 2:49 am ([msg=48190]see Re: Need Help with a program in C[/msg])

i'm studying at the university, not at home... i can't just go and skip things or use knowledge i'm not supposed to have to make an exercise... there would be no point....for now what i did is:-if/if else-for loop-the &&/||/! operator-printf() and scanf()-all kind of variables (likechar/int/float...)

by msbachman on Wed Oct 27, 2010 7:04 am ([msg=48193]see Re: Need Help with a program in C[/msg])

tgoe wrote:@msbachman

Unformatted code *within* code tags? How is this possible? xD

Oh shit another motherfucker's going to rag on my about my lack of indentation now, huh?

-- Wed Oct 27, 2010 7:20 am --

AscaL wrote:i'm studying at the university, not at home... i can't just go and skip things or use knowledge i'm not supposed to have to make an exercise... there would be no point....

About your comment about the for within a for loop, all that does is for each iteneration of the outside loop, it will run the inside loop. Then the counter or whatever will increment/decrement, and it will run it again.

that function doesn't do much of anything of importance, the real thing to recognize is that you can call a function within a function. Outside of class, think for a bit about how this concept might be able to help you out in your programs.

"I'm going to get into your sister. I'm going to get my hands on your daughter." ~Gatito

That function doesn't do anything at all, instead it will perform head recursion endlessly until stack space is entirely consumed and then it will error out. (yes, this program does nothing more then eat ~8mb of ram and then crashes via segmentation fault)

So to conclude on your last post, i'd say that such a method is useless.

"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein

That function doesn't do anything at all, instead it will perform head recursion endlessly until stack space is entirely consumed and then it will error out. (yes, this program does nothing more then eat ~8mb of ram and then crashes via segmentation fault)

So to conclude on your last post, i'd say that such a method is useless.

I think he just posted it as an example, he even stated that it doesn't do anything. Just to show him the concept of how it works. With some added checks it could prove quite useful for this problem.