473,396 Members | 1,853 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,396 software developers and data experts.

Help with for loops, please!!

22
Can someone please tell me how to do these???


Write a for loop to print the odd numbers from 1 to 99 (inclusive).

Write a for loop to print the multiples of 3 from 300 down to 3.
Nov 2 '06 #1
2 1455
r035198x
13,262 8TB
Can someone please tell me how to do these???


Write a for loop to print the odd numbers from 1 to 99 (inclusive).

Write a for loop to print the multiples of 3 from 300 down to 3.
You can't just have everything be done for you and expect to become a good programmer. At one point you have to stop and say, "Now let me have a go at this one first before I ask for help".
Nov 3 '06 #2
LacrosseB0ss
113 100+
for loops are incredibly simple. However, if you don't know the <b>mod</b> concept, you will have great difficulty with these problems.

Mod in java is coded with # % # and the result (which can be stored in a variable or output) is the remainder of a division operation.

Example:
4/2 = 2 BUT 4%2 = 0
5/2 = 2.5 BUT 5%2 = 1

If you use this in the loop, it'll help immensely. However, I'm with r035198x, these are help forums not 'please do my homework' forums. One thing I've learned over the years is that sometimes a programmer's best friend is Google.
-LB
Nov 3 '06 #3

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

Similar topics

4
by: patate069 | last post by:
hi! i have a problem. i dont understand... help me please http://www.animals-superstars.com/photo-109260.html tank you patate069
2
by: xpcer | last post by:
Halo everybody, can you help me, please. Can you tell me: 1. How many databases can we create in mysql (using Windows Operating Systems) 2. How many tables can we create in every database? 3....
7
by: Mickyd1561 | last post by:
Hey everyone I'm new to this groups thing and thought maybe someone can help me. My problem is that I can't view specific images on only one website. www.baseballu.net is my baseball team's...
0
by: karizmatrix22 | last post by:
I using Microsoft ASP.NET web matrix program to create asp website..i would like to link a image to the another page.for example..when the user click on the image it should take user to the next...
1
by: Andrea Belmonte - www.andreabelmonte.com | last post by:
Hi everybody, I'm developing a C# .Net (1.1 Framework) Windows Application, and I need to encrypt, using PKCS#1 v 1.5 padding, a string using an RSA 1024 bits public key, situated in a X.509 .cer...
3
by: james121285 | last post by:
I have written a program that will take the max and min of 10 set values. I have to now change my program to allow for these inputs to be entered in by another document, and print the values into...
0
by: bacterium | last post by:
Help me ,Please!!! I tried to use the DB2 database,but I got an error:SQL116N because of BACKUP PENDING,cannot connect or active"PBZXJK(DataBase Name)",SQLConnectAttr failured. Thanks!
2
by: Dalton | last post by:
This is all kind of in another language to, I mean I understand most of the words in relation to programming, but my field of work/study is IT. Anyways, on to the problem. I am working on my 5th...
0
by: rempit | last post by:
Is it true???Help me please.. I want to search data from Database..And..The result is view in new "DIV".. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="new.aspx.vb"...
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
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.