Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

c programing. "left of comma not working"?

im making this program that should output 10 lines of 8 asterisks, every other line should be indented. my indentation is not working

#include <stdio.h>

int main(int argc, char** argv)

{

int counter = 0;//stars on line

int stars = 0;//stars in total

int space = 0;

while (stars < 81) {//program will stop at 80 stars

if(space = 0 , counter <= 8){//rows 8 stars long

printf( "%s" , "* " );//prints a star

printf( "%s" , " " );//prints a space

counter = counter + 1 ; stars = stars +1; space = space + 1;}//increments counter and stars for new line and program termination

else if (space > 0 , counter <= 8){//rows 8 stars long

printf( " " );//prints a space

printf( "%s" , "* " );//prints a star

printf( "%s" , " " );//prints a space

counter = counter + 1 ; stars = stars +1; space = 0;}//increments counter and stars for new line and program termination

else if (counter = 8) {printf( "\n" );//new line after 8 stars

counter = 0;}//controls row length of 8 stars

}

}

There are no answers yet.
Be the first to answer this question.