Code:#include <stdio.h> #include <stdlib.h> int DrawRow(int length) { int i, count=0; for(i = 1; i <= length; i++) { printf("*"); } printf("\n"); return count; } int DrawSquare(int length) { int j,i, count=0; for(j=1; j<=length; j++) { DrawRow(length); count++; } printf("\n"); return count; } int DrawTriangle(int length) { int j,i,count=0; for(j=1; j <=length; j++) { DrawRow(j); count++; } printf("\n"); return count; } int DrawTriangles(int length) { int i,j,k,count=0; for(k=1; k<=length; k++) { DrawTriangle(k); count=k*count; } printf("\n"); return count; } main() { int choice,x,count,total,total_stars; while(1) { printf("enter a number greater than 0 here:\n", x); scanf("%i",&x); if (choice == 0) break; printf("choose 1(row of stars),2(square),3(triangle),4(triangles) or 0(quit)\n"); scanf("%i",&choice); if (choice == 0) break; if (choice == 1) total_stars=DrawRow (x); if (choice == 2) total_stars=DrawSquare (x); else if (choice ==3) total_stars=DrawTriangle (x); else if (choice ==4) total_stars=DrawTriangles (x); else if (choice >=5) break; total_stars=x+total_stars; } printf("\n"); printf("Numbers of stars are %i\n", total_stars); system("pause"); }

I'm trying to have it count the total number of stars or * when i finish. So I would enter the number on the first line greater than 0, and then on the second line and it would produce a line, square or triangle, and then enter 0, and 0 again to end the loop. However i can only make it count certain number of stars. Any help on fixing the count so i can count all the * ?