473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

While structure

i dont even know where to start with this question..can anyone do it?

Print the integers from 1 to 20 using a while structure and the counter variable x. Print only five integers per line. (Hint: Use the Modulo operator % to determine when every fifth integer has been printed)
Nov 13 '07 #1
5 1231
dav3
94
well do you know how to declare a variable?

that would be step 1.

step 2 would be setting up your while loop.

Expand|Select|Wrap|Line Numbers
  1.  
  2. while( variable < some value)
  3. {
  4.    do something
  5.    Increment counter
  6. }
  7.  
  8.  
Nov 13 '07 #2
Sally,

Dave gave you a good start. If you have other problems after you write this code. You just come back. Everyone seems pretty helpful here.
Nov 14 '07 #3
samido
52
try this as well:

<Code removed>
Nov 15 '07 #4
samido
52
i dont even know where to start with this question..can anyone do it?

Print the integers from 1 to 20 using a while structure and the counter variable x. Print only five integers per line. (Hint: Use the Modulo operator % to determine when every fifth integer has been printed)
OOPS:: try this...

<Code removed>
Nov 15 '07 #5
Ganon11
3,652 Expert 2GB
Samido:

Please refer to our posting guidelines for our policy about providing full code solutions to members. You can find our guidelines here.
Nov 15 '07 #6

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

Similar topics

2
by: Marco | last post by:
We can read this comment at php.net >jon >05-Nov-2003 10:06 >According to my tests, the "do...while" control structure actually seems to be ~40% faster than the "for" control structure. At...
24
by: Andrew Koenig | last post by:
PEP 315 suggests that a statement such as do: x = foo() while x != 0: bar(x) be equivalent to while True:
52
by: Rick | last post by:
Hi, For portability, can an issue arise if we use while(1) for an infinite loop in C? If so, should we then use for(;;)? Thanks, Rick
2
by: rashmi | last post by:
Hi All, ************************************************* error: variable `hdlc_cdevsw' has initializer but incomplete type *************************************************** This is the error...
6
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
3
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
8
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
9
by: John Salerno | last post by:
1 random.shuffle(letters) 2 trans_letters = ''.join(letters) 3 trans_table = string.maketrans(original_set, trans_letters) So what I'd like to do is have lines 1 and 2 run once, then I want to...
12
by: Mik0b0 | last post by:
Hallo. Let's say, there is a structure struct struct10{ int a1; int a2; int a3; int a4; }count={ {10,20,30,40}, {50,60,70,80}
9
by: somenath | last post by:
Hi All, I have doubt regarding how compiler understands about while loop. For example the bellow mentioned code produce the output as mentioned bellow. #include<stdio.h> int main(void) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.