Over 1 million tech questions and answers.

Java: Sum of all odd numbers between two numbers?

Q: Java: Sum of all odd numbers between two numbers?

Hi, so far i have managed to make my program so that it prints out the odd numbers between two inputted numbers but i need it to print the sum of them?
This is what i have:

public static void main(String[] args) {
int int1, int2, sum = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Please enter two integers: " );
int1 = scan.nextInt();
int2 = scan.nextInt();
for (sum = int1; sum <= int2; sum++){
if ( sum %2 != 0 ){
System.out.println("" + sum);
}
}
}
}

RELEVANCY SCORE 200
Preferred Solution: Java: Sum of all odd numbers between two numbers?

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Java: Sum of all odd numbers between two numbers?

Read other 9 answers
RELEVANCY SCORE 90.4

Hey everybody.

I don't know if the title is a good one for this problem, but here goes.

I have a column that has numbers in this format: 54321-1234

Now, I want to take off the last 4 numbers, and the dash, from all the numbers in the column, using a formula. So that the output would be: 54321.

I want it so the first 5 numbers stay the same, but the dash and last 4 are gone. Is this possible?

Thanks.
 

A:Solved: Excel 2003: Replacing Large Numbers with Smaller Numbers

Read other 13 answers
RELEVANCY SCORE 90

This was asked before by KlausdB:

"I have 4 x HDDs on SATA AHCI (Intel Controller) in Native Mode and 1 x ESATA on Win 7 Pro X64.
I noted that looking in Admin. Tools\Computer Management\Storage (as an example) the 1st HDD (Port 0 in the AHCI BIOS) is showing as "Disk 2" instead of my expectation of


"Disk 1".
Selecting the Drive's Properties correctly shows the "Location 0 (Channel 0, Target 0, Lun 0)".
I also note that the Disk Number allocation in Windows will change randomly after some reboots/startups - going anywhere from "Disk 1" to "Disk 4".  I can force/replicate this


behaviour by removing the ESATA drive.
Is this expected behaviour?
It doesn't appear to create any operating issues at this stage, however, is there a way I can force the Drive to always map to (eg) Device 0 --> Disk 1, Device 1 --> Disk 2,


etc?
Thanks."


 This was answered by Nicholas Li:

"As far as I know, how the disk is plugged physically and the order it is displayed are not related. For a simple example, if a drive is plugged to SATA interface 4 and it is the only disk, it will be displayed as Disk 0. If there is no related issue about
the disk order, I think we can safely ignore this."


 Because the topic was closed I want to ask a new question here:
 What happens if one of the 4 HDD drives or 5 has an OS installed on it? I ask because windows always write some bo... Read more

Read other answers
RELEVANCY SCORE 89.2

I have three SATA hard drives :
Main system/boot drive , WD Caviar Black 1 TB, connected to the SATA 0 port
A backup drive, identical WD Caviar Black 1 TB, connected to the SATA 1 port
Another dirve, Hitachi 1 TB, connected to the SATA 2 port
When I installed Win 7, only the main drive was connected... and it remains the only drive with active/system/boot partitions.

QUESTION 1.
All three drives reporr correctly in the BIOS, and in the right order, but why is it that only one of the drive (the one on SATA port 1) has a "SATA:" prefix and the others have a "HDD:" prefix ?

QUESTION 2,
Why is it that the assignment of Disk #0, 1, 2 ( as seen in Disk Maanger or DiskPart) does not seem to have nay rhyme or reason?

I would have expected:

- the hardrive connected to SATA port O, to be assigned as Disk 0
- the hardrive connected to SATA port 1, to be assigned as Disk 1
- the hardrive connected to SATA port 2, to be assigned as Disk 2

but instead, I have:

- the hardrive connected to SATA port 2, is assigned as Disk 0
- the hardrive connected to SATA port 0, is assigned as Disk 1
- the hardrive connected to SATA port 1, is assigned as Disk 2

Just curious why that is.

I am assuming there is no way to chagne this. Its not something I would dream of reinstalling Windows 7 to correct ( even if it did correct it).

A:SATA port numbers vs assignemnt of Disk numbers/

Best advice, leave it alone. It may bother your (and others) sense of order but it won't affect how anything works, and no re-installing Windows won't change it.

Read other 9 answers
RELEVANCY SCORE 87.2

I have Windows XP, with Wordpad v5.1 and Notepad v5.1 as well. In Notepad, if I toggle off Word Wrap, I can then toggle on the Status Bar, and it shows me the line and column number in the status bar. It does not look like Wordpad has the ability to show line and column numbers. Does anyone know if there is a way to show that in Wordpad? Thanks.

Read other answers
RELEVANCY SCORE 87.2

I have been given four transcripts of telephone calls recorded at a call centre. All at different times on the same day. Two have the same callID number. The sequence of the numbers attributed to each call are odd. The first call has a higher number than later calls and the last two are also out of order. I am not sure if this is the right forum but i am desperate for some help. The transcripts are VERY important and I cannot be sure that they are the real deal because of the callID numbers. Any suggestions? Thank you in advance.
 

Read other answers
RELEVANCY SCORE 87.2

I was checking my program and software list and at the top of the list I noticed two (2) sets of numbers that I have never seen before. I checked the internet to see if I could find out what they were. It kept taking me to sites for spyware, adware,etc. I could not find out what they were or why they are on my system. I do not want to remove them until I know what they are. I have not noticed any problems with my system, but I do not know what might be going on behind the sceen. The numbers are listed as follows:
{684CB795-C157-4E15-93D4-E26015FEF1EA}

{F850707C-B6A0-4B56-8709-F89CF8F9AC6D}

ANY HELP?

A:Found Numbers Unknown Numbers In System

The first one > http://www.acresso.com/products/is/i...d-overview.htm

The second one > http://eraser.heidi.ie/

Both are legit and not malware.

Read other 1 answers
RELEVANCY SCORE 82.8

Yes. I am a beginner, and so I was hoping if someone knew how to display 10 random real numbers between 0 and 10 in Java. The problem I am having is displaying 10 different numbers generated from one Math.random statement. This is what I have so far:

public class RandomNumber {

public static void main ( String[] args ) {

double number;

number = Math.random() * 11;

System.out.println ("Here are ten random real numbers between 0 and 10:");

System.out.println (number);
}
}
 

A:Solved: How do I display ten random numbers in Java?

Read other 10 answers
RELEVANCY SCORE 82

Rank beginner at Java. Need to pull out the month, day, and year separately from an integer. Here's what I have done. It's compiling now (that's an improvement!), but gives me a "String index out of range" error.

Since the spaces are causing trouble, I believe, the error throws on the indicated line -- as soon as the code runs into the first space. How can I do extract this information? The format of the birthdate, with spaces, cannot change.

//Get the date of birth.
System.out.println("Please enter the renter's date of birth (mm dd yyyy): ");
birthMonth = kb.nextInt();
String birthDateString = Integer.toString(birthMonth);
String birthMonthString = birthDateString.substring(0,1);
String birthDayString = birthDateString.substring(3,4); //error throws on this line
String birthYearString = birthDateString.substring(6,9);
birthMonth = Integer.parseInt(birthMonthString);
birthDay = Integer.parseInt(birthDayString);
birthYear = Integer.parseInt(birthYearString);

Thanks.
 

A:Solved: Java -- how to get substring from a string of numbers with spaces

You've marked this solved, but no responses have been given. Can you please confirm that you've found the solution yourself, or else click "mark unsolved" to alert helpers that assistance may still be needed.

Edit: Or, I suppose I could just look at the next thread in the forum and see for myself.
 

Read other 3 answers
RELEVANCY SCORE 79.6

Hi,
I have some reference books I use and in all of them I have this problem:

The number written on the document pages doesn't match the number my pdf reader says, and for every document it has a different offset. That is, for example when I go to page 16, then on the page itself it's written that it's page 5 and not 16.

It's an annoying problem.
Is there any way to fix this by changing the pdf numbering or is there any workaround?

Thanks
 

A:pdf page numbers don’t match document page numbers

Read other 16 answers
RELEVANCY SCORE 73.6

Hi. Big problem with an assignment. For some reason, when I input 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 into this program, it tells me my largest is 9 and second is 0. Any Java experts here that can tell me how to fix this to have 8 as the result of 2nd largest?


--------------CODE----------------

import javax.swing.JOptionPane;
public class a3c4e23
{
public static void main (String args[])
{
int counter = 0;
int number;
int largest = 0;
int second = 0;
while (counter<10)
{
counter++;
number = Integer.parseInt(JOptionPane.showInputDialog("Enter integer"));
if (number >= largest)
largest=number;
else if (number < largest && second >= number)
second=number;
else
largest = largest;
second = second;
}

System.out.println("Largest number input: " + largest);
System.out.println("Second largest input: " + second); }}

--------------CODE---------------------------


Thanks a bunch,

SpeedRacer5
 

A:Java program to input 10 numbers and return the largest and 2nd largest

Read other 7 answers
RELEVANCY SCORE 62.8

My Sandisk reader for my camera went bonkers. Now I want to buy another one cause the camera is still good. Anyway, It says it takes a 2.0 usb port, which I know I don't have if its more than 4 yrs old. Anyway, how can you tell what your usb port number is? I have just the regular usb ports that come with the computer, it says its backwards compatable and works with the 1.1 usb port number.????????????? Any help would be appreciated.
 

A:USB numbers?

Read other 6 answers
RELEVANCY SCORE 62.8

If I sent an email to someone, is it possible for them to get my IP address from that email?
 

A:IP Numbers

Read other 13 answers
RELEVANCY SCORE 62.8

Hi i am setting up a home network on a domain. and windows 2000 server is asking for numbers such as DNS numbers, WINS numbers. Where do i get these from or do I need to make some up.

Thanks
 

A:Numbers etc. where do i get these from

Read other 10 answers
RELEVANCY SCORE 62.8

I want to upgrade my laptop RAM from 4 GB to 6 GB. Before buying the 4 GB RAM I have to know the exact pin of the RAM, and I don't know the exact numbers of pin in the RAM. My laptop is Ideapad Y550 4186. So how can I know the numbers of pins in the RAM without having to open the case? Please help!

A:How to know numbers of pin in RAM?

It's 204 pin, but you need to know more than that.

That's a Lenovoe Ideapad Y550. I entered that make and model into the configurator at Crucial.com and it came back with the following compatible RAM choices for that laptop.

Computer memory upgrades for Lenovo IdeaPad Y550 (All Types) Laptop/Notebook from Crucial.com

3 of those choices are for 2 GB sticks.

You can shop for those same Crucial part numbers from your source or buy 204 pin RAM from another brand as long as it has the exact same specifications.

Read other 6 answers
RELEVANCY SCORE 62.8

Windows 98SE

while online how do you check your DNS numbers?
I typed winipcfg in the run box but I don't see them there, does anybody know the command to check DNS numbers while connected.

Thank you.
 

A:DNS numbers

Read other 6 answers
RELEVANCY SCORE 62.8

hi all
can anyone help please

on a excel sheet i need h1 to only allow certain numbers to be entered, if any other numbers are entered then an error message to show

i.e only the numbers 2, 4, 5, 8, 9, 10, 12, 14, 17, and 22 need to be entered in cell h1 for other calculations to be carried out. any other number can be entered but on doing so i would like a error message to show

many thanks
 

A:only certain numbers

Have a look in 'Data Validation'.
 

Read other 1 answers
RELEVANCY SCORE 62.8

I hear that soon we will all have a personnal ip number. IP version 4 or something similar? Is this a good thing?
 

A:IP Numbers

Where did you hear that?
There are too many people for individual IPv4 numbers. IPv6 could do. But I still doubt that.
It's a Bad Thing if something like this happens.
 

Read other 6 answers
RELEVANCY SCORE 62.8

Is there a way to find out what part of the world a certain IP number comes from, or are they all just random?
 

A:I.P. Numbers

Read other 8 answers
RELEVANCY SCORE 62.8

I wonder why on programs downloads for 32bit OS are tagged as "x86" while 64bit OS program downloads tagged as "x64",what does the "X" stands for and why the value of 32bit is bigger.

A:OS Numbers..?

x86 - Wikipedia, the free encyclopedia

Read other 3 answers
RELEVANCY SCORE 62.8

What and where do i type in to get the numbers that i used to install my w98se software? I can't remember what to do to recover those numbers , or can someone provide me with a set that works? I've seen them on my setup, forgot how to recover -

thanks
 

A:win 98 se numbers

Read other 7 answers
RELEVANCY SCORE 62.8

Hi all, I am running Vista and using PC Doctor for protection. I get pop-ups regularly that say a "Bad Website" is blocked??? All I get are the site numbers such as:

68.36.166.127

How can I determine if this website is necessary or if I should block it? I get 5- 10 of thses a day. I am afraid that if I block all of these, I may disable some programs. Is ther some way I can tell what these numbers are referring to?
 

A:URL Numbers..what are they?

Read other 6 answers
RELEVANCY SCORE 62.8

My system is an IBM P4 3.2GHz running Windows XP Pro SP3. When I power the system on, there are some Hex numbers that appear at the lower right of the monitor screen such as 003B, 0075, 0078, 0073 and probably several others that I can't see because they come and go rather quickly. Does anyone know what these numbers mean and is there a problem with my system because these numbers appear?? My system appears to boot & run correctly and there are no hardware or software problems that I'm aware of.

Thanks for any help here.

David

A:What do these numbers mean??

Do they appear and change when you move your mouse? When you press a key on the keyboard? It looks like it could be some type of debugging information but nothing harmful.

Read other 3 answers
RELEVANCY SCORE 62.8

What is an (Internet) IP number, and how unique is it. Does each Internet user have an unique IP number?

For each message posted, why is it necessary for this site to log IP numbers, which are inaccessible even to the poster?

------------------
R. J. Emery
 

A:IP Numbers

Read other 13 answers
RELEVANCY SCORE 62.8

I have a program written in Delphi which display a result in a box(editbox).
The signs is to big for the box - the last digit disappears. All the other text and numbers are the right size. The program work well on a identical PC with the same OS - Win XP home SP2. It must be something with the windows settings. Grateful for any help.

Read other answers
RELEVANCY SCORE 62.8

This is basically for my father, his numbers on the key pad to the right of the key board are not working. In the past I have checked several options and ended just hitting some keys (i.e. alt F4) until one of them seems to work. Now he is having problems again. Is there something else he can do?

Thanks
 

A:Key pad numbers

is it possible that you have pressed the number lock key, this is situated on the row above the number keys...mine is above the number 7 key.

press it and see if this solves the problem
 

Read other 1 answers
RELEVANCY SCORE 62.8

it was working just fine a while ago now when i try to type a number this is what happened

41=1
52=2
.3=3
41=4
52=5

someone help me out please..

A:Numbers pad

What you describe can be a sign of the keyboard going bad. Are letters affected when you type those?

Do you have access to another keyboard you can use to see if it also happens with it?

Read other 3 answers
RELEVANCY SCORE 62.8

Is there a way to track IP numbers? I have some numbers here and I want to know who this people are, or at least where they come from, so I can have an idea who this person might be...

Here are the IPs:

200.10.225.73
200.206.238.33
200.158.95.9

Thanks for your help
 

A:IP numbers

Read other 8 answers
RELEVANCY SCORE 62.8

Is there a way to input an ISP number to find out who or where it came from ? I thought I read somewhere on the web that you could do that,but did not write it down.
I am getting Email hoaxes about buying something from Joshua Hardware Store and when I ran some order tracking numbers I got "page cannot be found" then again and i got "this domain has been disabled.
When I click on the message I get a warning box that has File Name: read_more[1]txnotepad.scr
File Type: screen saver
From 69.56.132.17
Then when you click on the paper clip another warning box has:
File Name: order(1)txorder.scr
File Type: screen saver
From: 69.56.132.17
This message tells me that my credit card was billed :
First message was for $55, next one dated 7-6-03 is for $155 and says Item purchased SS005KA (see attachment). When you click on attachment nothing happens. I checked my credit card file and nothing has been charged and I have never ordered anything online in months. So I know this is not legit.
I tried did a search on Joshua Hardware and it does not exist.
When I went back to the first order sent on 4-4-03 and clicked on the tracking number it took me to a page not found and there it had the ISP number so I clicked on it and it took me to a page that said" This domain has been temporarily disabled. To restore the domain,contact your Customer support Rep".
 

A:ISP numbers

This is the domain it is coming from.

Use one of these links:
http://combat.uxn.com/
http://www.antifraud.com/ipcheck.htm
http://www.samspade.org/t/
http://www.all-nettools.com/tools1.htm
 

Read other 3 answers
RELEVANCY SCORE 62

Using Windows 98 with Microsoft Internet Keyboard. All current upgrades installed. Pentium III processor. MS Optical Intellimouse.

Everything works fine except the number pad on the right side of the keyboard. NumLock is on but nothing transmits to programs when a key is depressed. With numlock off, keypad functions work normally as arrow keys. Numbers keys at top of board work okay too.

Tried upgrading with latest MS drivers for both keyboard and mouse and pouring over startup BIOS options but no joy - same ole, same ole.

Any suggestions?
 

A:Keyboard numbers

1) Try in DOS - boot from floppy and see if they work.

2) Try in Safe Mode to see if they work.

Let us know.
 

Read other 3 answers
RELEVANCY SCORE 62

I've had this dsl modem for a couple years now and have always to my knowledge been able to use it via only one ip number.i've been streaming video using webcamxp and other software/.today my modem began acting stupid by disconnecting once an hour and if I shut off pc of at all,i wind up having to manually reset the modem by unplugging it for a few seconds and then back in again.i eventually noticed that while the webcam is streaming video ,my lan connection on the pc shows the ip number i'm familiar with while my dsl modem shows one that's new(so to speak)..so I entered both ip numbers in to the webcamxp and found that the modem streams using either ip number..if I go to the what's my ipnumber site,it will display whichever number I have entered in to the webcamxp software//.is it normal for a modem to use 2 numbers as I don't believe this has occurred in my case before.i'm wondering if it has to do with the modem suddenly disconnecting now and then and too,having to reset it everytime I boot.i have att dsl ,no live landline just dead phone cord from the modem to the wall.
 

A:Modem with 2 ip numbers

If you have other devices and they also loose internet connection at the same time, I would recommend contacting AT&T.
 

Read other 1 answers
RELEVANCY SCORE 62

Does anyone have "any" image resource numbers for Windows 8?

A:Resource numbers

I'm unsure what you are asking? Can you elaborate?

Read other 14 answers
RELEVANCY SCORE 62

Could someone please tell me what all these temp. readings are for.

Which one is for CPU?

Thanks in advance.

p.s. I hope I did the screen capture right. Its my first try ever.
<img src="file:///C|/intl.%20free%20XXX/corel.gif" width="415" height="476">
 

A:can someone explain all these numbers to me.

Your screen shot isn't showing up, did you upload it with the attach file option on the lower part of the reply window.

Just hit the browse button next to the file attach window and upload the screenshot
 

Read other 3 answers
RELEVANCY SCORE 62

Whenever i go to type in a URL it comes up as numbers. it types in order of 0-9 and repeats no mater what i type so if i type in WWW. Google.com it reads out 34567890123456 or if i type out abcdefghijklmnopqrstuvwxyz it comes out 56789012345678901234567890 but if i paste abcdefghijklmnopqrstuvwxyz it reads abcdefghijklmnopqrstuvwxyz

i don't know what this is or why it does this, i have read other threads on the same thing and it says its a virus or a script error if it is either how can i fix it?

A:My URL box only types numbers

If you're using complete Comcast services, the problem exists due to a conflict with Guardian. Call Comcast. Toggling Numbers Lock is probably fruitless, but try anyway and also a different keyboard although I don't think that's where the problem lies.

Read other 2 answers
RELEVANCY SCORE 62

Hi, I am trying to make a comparison against a set of data and rank them accordingly. The data can comprise up to 150 rows.

I compare data in column 1, get the ranking from there and if there is a tie for certain rows, I compare data on column 2 only for the rows that are tied. This is repeated until there is no more tied data or until all the columns have been exhausted.

I have attached the sample data and also the expected answer for easy reference. Thank you in advance to anyone who can help with this.
 

A:Ranking a set of numbers

You didn't said about the order of the ranking should it be upward or downward?
Also I'm not sure I understood the process, cause the way I understood it, the ranking should be a little bit different?
Do you just wanna the ranks or you wanna to sort the data too?
 

Read other 3 answers
RELEVANCY SCORE 62

XP has a habit of remembering which com port numbers have been used before to other devices in the past. This leads to funny situations where com port numbers that are allocated to a new device seem to be high in number (sometimes greater than 20, very often greater than 10).

Is there a registry fix to force the operating system to cancel port numbers where devices are no longer detected, thus enabling new allocations to be in a sensible range of numbers

thanks for any help
joe

Read other answers
RELEVANCY SCORE 62

This is not a problem. Just a curiosity that I am unable to explain. Maybe someone has the answer.

1. When I look into Computer or computer management, the size of my system is about 16.3 GBs. The data is on another partition and there are no restore points - shadowstorage is zero.





2. If, however, I run WinDirStat, it shows my system size as 18.1 GBs. I fail to see from where the additional 1.8 GBs come from.

A:Curious numbers

Hidden files and folders perhaps?

Read other 3 answers
RELEVANCY SCORE 62

Is there a way to validate hash numbers on an allready installed win7 ?

A:Help| Hash numbers

No, only the original .iso you installed from can be validated with hashes.

Read other 3 answers
RELEVANCY SCORE 62

Hey everyone,

I am using build 7000. Is there a place where I can legally download the newer builds?

And do they require a clean install?

A:Win 7 Build Numbers

The only build that has been officially released by Microsoft is 7000. However, others have been leaked, viz 7022, 7048, 7057 and 7068 (and others). These can be downloaded via torrents (use Google). In all cases, the same product key will work. I recommend a clean install for all OSes, especially beta versions.

Read other 9 answers
RELEVANCY SCORE 62

What gives? We have a wireless Linksys system with a G router and G wireless card in the computer having problems. A month or so ago we kept losing the connection and LinkSys recommended putting in the DSN numbers for the connection. They thought that some of the security and spyware protection programs might be interfering with the automatic detection settings. We did that and it seemed to work ok for a while. Now

In the last three days the Network Properties TCP/IP properties, the DSN numbers keep being erased. The TCP/IP setting for the wireless adapter is not there either.

Anyone have any idea what could be up? How do you get the wireless card specific TCP/IP listing back?
 

A:Disapearing DSN numbers

Read other 10 answers
RELEVANCY SCORE 62

Can an IP number (NTL) be the same for two different senders of emails.
 

A:IP Numbers Emails

Read other 7 answers
RELEVANCY SCORE 62

I have a Lenovo when I go to gotomypc the keyboard types numbers instead of letters, it stays in sequence 0123456789 and repeats.

A:Letters to Numbers

Welcome to Seven Forums Jerrjames. Does this only happen in GoTo? If not, press the Num Lock key (or Shift & Num Lock ) to type the letter on keys that are shared with numbers. A Guy

Read other 9 answers
RELEVANCY SCORE 62

I have digitrex 2100 camera and the fool thing keeps saying serial # is wrong but am using one that is on the cd what to do?
 

Read other answers
RELEVANCY SCORE 62

Hello,

I need to put on pages sequential numbers. I know that MS Word can do that but the problem is that I need to put those number at several different locations per page, but not sure if Word can do that.

Is there way to do that in MS Word or is there dedicated software for that?

Please see the image. Thanks.
 

A:I need to put sequential numbers.

Read other 8 answers
RELEVANCY SCORE 62

I noticed the amount of space left on this external hardrive and looked at the file size inside and it doesn't add up the recycle bin says its empty so where are the Gb 's
by my rekoning 776gb and 103gb = 879gb leaving a 52gb deficit from 931gb
Anyone?

A:Numbers dont add up!

Why not start with this. Lets see exactly what is on the drive
You can place the mouse (or click) on any segment to see the contents.
WinDirStat - Free software downloads and software reviews - CNET Download.com

Read other 9 answers
RELEVANCY SCORE 62

Hi. Just a curiosity question.
I just noticed that when I check my IP number with Firefox it gives me a completely different number than when i check with IE. Not only that it gives me a different country!!
I just want to know why that is. Why I'm getting 2 different numbers/locations with 2 diffrent browsers.
 

A:Question about Ip numbers

Read other 10 answers