Hey guys and girl i need your help in program only in C CODE user press only odd numbers then the following result has been shown like

if 3 then

***
* *
***

if 5 then
*****
* *
*****
* *
*****
PLZ HELP ME >>>> Thanks

Recommended Answers

All 8 Replies

f 5 then

*****
*      *
*****
*      *
*****

PLZ HELP ME >>>> Thanks

remember in even column only 1st and last star will print not else there are spaces among them.

sorry, your question is not urgent.

and the fact that you have spammed it here multiple time, now just moved you to the very back of the queue.

There's a queue?

That's mighty generous of you, I was just going with "ignore" ;)

commented: well, to be honest, it's the "ignore yo' ass" queue.... +7

Seems like you could scanf() and get a number from the user

and then use a for loop to print out the lines of *'s, alternating between the user's number of *'s, and two *'s.

So every time your iterator in the loop is even, you want the user's number of *'s, and when the iterator is odd, you want just two *'s.

i % 2 == 0 is a very good test you might use, to see if the iterator i is even or not.

Give that a try and post up your code.

AND USE CODE TAGS AROUND YOUR CODE - ALWAYS

i need a solution if anyone have plz

i need a solution if anyone have plz

Then write one yourself. Take the hints already given and start coding. Nobody here is going to write your program for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.