Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (lgbasallote):

how to create this figure * * * * * * * * * using dev c++ and only using the codes if, for and printf

OpenStudy (anonymous):

c++?? you mean using both?

OpenStudy (anonymous):

Here is what I did in Python. I am not good with C++. But hopefully the readability of Python will give you an idea what to do in C++. I'll see if I can do it correctly with C++, too.

OpenStudy (lgbasallote):

lol like i said i can only use if, for and printf

OpenStudy (anonymous):

Oh. I'll try that.

OpenStudy (anonymous):

it's like if(i<=3) for(i=0;i<3;i++) printf(.......) } else { for (i=3;i>0;i--) printf(..............); }

OpenStudy (anonymous):

sry u got to use another for inside that for like for (j=0;j<=i;j++) printf("*");

OpenStudy (anonymous):

Updated my python code (I really don't mind if you find little benefit from my posting of this code, this is beneficial and fun!): for star_num in range(1, 4): #added 1 because I don't want 0 stars print "*" * star_num if star_num == 3: for star_num_reducer in range(1, 3): print "*" * (3 - reducing_star_num) #don't think C++ can multiply characters

OpenStudy (lgbasallote):

thanks @A.Avinash_Goutham i'll try that

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!