how to create this figure * * * * * * * * * using dev c++ and only using the codes if, for and printf
c++?? you mean using both?
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.
lol like i said i can only use if, for and printf
Oh. I'll try that.
it's like if(i<=3) for(i=0;i<3;i++) printf(.......) } else { for (i=3;i>0;i--) printf(..............); }
sry u got to use another for inside that for like for (j=0;j<=i;j++) printf("*");
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
thanks @A.Avinash_Goutham i'll try that
Join our real-time social learning platform and learn together with your friends!