473,473 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

asterisk algorithm

joewin
2 New Member
Guys, help me.
Give me some hints on how to do this program . . .
a program that will print an asterisks and zeroes one-at-a-time and will to print like the following pattern.

**0**

*0*0*

0*0*0

*0*0*

**0**
Mar 2 '17 #1
2 1763
weaknessforcats
9,208 Recognized Expert Moderator Expert
You could always:

printf("**00**\n");

and use a separate printf for each pattern.

If you can't do this, then there must be some required things left out of your problem description

Are you using C or C++?
Mar 2 '17 #2
dev7060
639 Recognized Expert Contributor
Yes, the above pattern can be printed using output statements. However, you may also use loops for this. Try to mention your approach/code you are using.

Some idea: In the 2nd line, you can observer that 0s are present at even places [*2*4*] and in the 3rd line at odd places [1*3*5] etc. So, declare an array of length 5 and use the modulus operator to check for even and odd places and assign the value of 0 to them, the rest of the array can contain *.
Mar 3 '17 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sarmin | last post by:
Hi Pythoners... It seems to me the Asterisk (*) sign in python means many things... if a python code line looks like this: def__init__(self, func, *param): bla bla bla... and then u have...
1
by: sarmin kho | last post by:
Hi Pythoners... I am definitely confused with the use of asterisk (*) sign in python... I quoted the following code from 'python cookbook' text book page 223 about 'running functions in the...
2
by: Marco | last post by:
Hi all, I saw the following line in a C source. what's the asterisk * mean? Thank you! fprintf(conn_out, "%.*s\r\n", (int)(strlen(buf + 1) - 1), buf + 1);
3
by: Robert M | last post by:
Hello, I am having a problem when I enter a new row using data grid footer and the data contains asterisk ('). I can use replace function, and it will not crash the program but it shows 2...
2
by: Evan | last post by:
I am trying to put an asterisk in the Label text property but the asterisk doesn't show up in the correct place. If I enter "* hello" in the text property (using the designer property pages) the...
4
by: deepee | last post by:
I have a drop down box in HTML using SELECT and OPTION tags: <select title="Choose a number" onchange="obscure()" name="Digit1" ID="Digit1"> <OPTION VALUE="">&nbsp;</OPTION> <OPTION...
0
by: selvarani | last post by:
Hi all, I am a newbie to Asterisk and PHP. I have installed wamp5_1.4.3 and working with PHP on this. I would like to write a PHP script to interact with asterisk. Where are the Manager API's...
1
by: striker07 | last post by:
Someone help me how can i display a diamond shaped asterisk correctly pls. correct my program this is my code: Dim ctr, space, asterisk As Integer For ctr = 1 To 9 Step 2 For space = (9...
2
by: Coll | last post by:
I'm working with a form & a query that allows the user to filter the data using several combo boxes. One of the combo boxes allows them to select the first letter of a a particular field, and it...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.