Ok, so my beginning to C programming class has started and I have understood the concepts thus far. There is this one programming excercise I am having an issue with. The excercise asks you to create a program that results in the following output:
Smile!Smile!Smile
Smile!Smile!
Smile!
The only requirement is that I use a function that prints smile once, and then calling upon that function as many times as required to produce the above output. The following is what I have s o far
#include <stdio.h>
int main (void)
{
smile(), smile(), smile();
smile(), smile();
smile();
return 0;
}
void smile (void)
{
printf("Smile!");
}
This is producing an output of
Smile!Smile!Smile!Smile!Smile!Smile!
I know I need a line break ("\n") some where in there, but where. I have tried putting it everywhere and cannot seem to get the require output.
BTW im using Ubuntu Intrepid Ibex server with GCC . My prog is compiling without error, I know I am missing something.
Your help is greatly appreciated!