Hay guys, I have to take a stupid C course, and since I hate programming and computers in general, I am find some stuff hard. Like this questions.
I gotta write a program using only the following three output statements
(Each one appearing ONLY ONCE in your program):
printf("* "); printf(" "); printf("\n");
I am only allowed to use stuff like the if, and while stuff, and the output is supposed to be
* * * * * * * *
_ * * * * * * * *
* * * * * * * *
_ * * * * * * * *
* * * * * * * *
_ * * * * * * * *
* * * * * * * *
_ * * * * * * * *
(_ means a space, I cant get it to show)
If you help me I be best friend long time!
Here is the code I have so far, it doesn't work :(
#include <stdio.h>
int main()
{
? ? ? ?int counter1;
? ? ? ?int counter2;
? ? ? ?int counter3;
? ? ? ?counter1 = 0;
? ? ? ?counter2 = 0;
? ? ? ?counter3 = 0;
while ( counter1 != 4 ) {
? ? ? ?while ( counter2 != 8 ) {
? ? ? ?counter2 = counter2 + 1;
? ? ? ?counter3 = counter3 + 1;
? ? ? ?printf ( "* " );
? ? ? ? ? ? ? ?if ( counter3 == 8 ) {
? ? ? ? ? ? ? ? ? ? ? ?printf ( "\n" );
? ? ? ? ? ? ? ? ? ? ? ?printf ( " " );
? ? ? ? ? ? ? ?}
? ? ? ?}
counter1 = counter1 + 1;
counter3 = 0;
counter2 = 0;
}
return 0;
}