What am I doing wrong. I have problem with operators

I have problem with following code. I am trying to use the operators in the array but I can't make it work.
The result of the program commes up:
58
60
57
The correct result should be:
15
-5
50
What am I doing wrong?
class Operators{
     public void operators (){              
          char [] operator = {'+','-','*'};
          int a = 5;
          int b = 10;
          for (int i=0; i<3;i++){              
               int c = a+operator[i]+b;
               System.out.println(c);          
     public static void main (String[] args){
Operators op = new Operators();
op.operators();

Sorry to confuse you. When I have posted the first message I tried to simplify the problem. By doing this thought that I could figure out the rest of the problem by myself. But instead of getting answers I got more confused. What I am trying to do am:
To take six or more numbers and put operators between numbers and display the result. I need to display the results for all possible operator combinations between the numbers.
For example if I take six numbers 10,20,30,40,50,60 and I put the arithmetic operators in between the numbers I would like to create all possible results operator combinations and what the result would be.
10+20+30+40+50+60 = 210
10+20+30+40+50-60 = 90
10+20+30+40+50*60 = 3150

Similar Messages

  • Does anyone still have problems with Premier Pro on Maverick? and is there any known fix?

    Does anyone still have problems with Premier Pro on Maverick? and is there any known fix?

    I know OSX 10.9 Mavericks introduced a power saving feature called App Nap which is meant to slow down applications that it determins are inactive (or when minimized). This would mostly likely cause problems if you're dynamically linking After Effects comps to your timeline or sometimes exporting to Media Encoder.
    Try disabling App Nap for all your Adobe App files...
    Go to your Applications folder
    Go into individual Adobe app folders (ie. Adobe Premiere Pro CC)
    Right-click on the Adobe app file (ie. Adobe Premiere Pro CC.app) and select Get Info
    When the info window opens up, add a checkmark beside "Prevent App Nap"
    Restart the application
    This fixed all my performance issues.
    -Pete

  • Does anyone else have problems with the new macbook pro trackpad?

    I exchanged my new macbook pro last week because there was a major trackpad lag. Every time I put it to sleep and woke it up, the trackpad would delay 5 or more seconds. I took it in to the Apple store and they said it could be a software issue and I exchanged it. However, I just opened up this one up from the package today, and there's still a lag. Does anyone else have problems with that? I don't want to exchange it again, so is there something I can do?

    Also, is it mandatory to run software updates when you first turn on your computer?

  • HT1725 I have been trying to purchase points for a slot machine game using my itunes card. It has subtracted all the $$$$ off the card but I never got the points. Not sure what I am doing wrong. Have restarted the ipad and still nothing.

    I have been trying to purchase points for a slot machine game using my iTunes gift card. It subtracted the right about of $$$ but never gave me my points....not sure what I am doing wrong.
    Any help will be appreciated!

    Contact iTune Support
    https://ssl.apple.com/emea/support/itunes/contact.html

  • Does the Intel have problems with flip4mac?

    Hi, I have a new intel Core 2 duo iMac and there are two websites that I cannot view flip4mac plugsin on but I can on all other websites. My powerpc eMac can view the websites (videos) that I can't view on my iMac and both of my computers have the exact same system software, Safari versions, Firefox versions, and they both have flip4mac version 2.2.0.49. The only difference is one computer is a powerpc and the other one is an intel.
    Apple has not been able to help me. Does anyone else have this problem with their intel iMacs?
    Thank you!
    Martha

    The reason I didn't put the links is because on both sites, you have to put in your email address to register. Anyway...
    Try this website out:
    http://www.crenshawchristiancenter.net/ecomm/index.php?option=com_content&task=v iew&id=2&Itemid=4
    Put your mouse on "Media", go to "Ever Increasing Faith" and a new window will launch, then click on "archives." None of the archives or any links in that new wndow will work on my iMac.
    The other website is:
    www.godslearningchannel.com
    You don't click on anything on the left side, you go down to below where it says:
    "The GLC bookstore is proudly carrying V!BE. Click here for more information."
    Go below that and you will see a moving box and you click on THAT. It will then ask for a faith pass, you put in an email address and then you can see the video link that is not working for me.
    God's learning channel will NEVER send you anything even though you "joined".
    I eagerly wait to see if you can view either videos.
    Thanks,
    Martha

  • Does anyone else have problems with retina screens? My eyes are constantly hurting and my eyesight is getting worse in a short period of time.

    I've been using high quality retina screens for about nine months now and my vision has gone downhill quickly. I got my first ever prescription for eye glasses and my eyes are constantly strained. High resolution screens also cause other problems with my normal work flow as a web designer but that is a whole other topic.

    try turning down the brightness, If i even have it past half way my eyes hurt. maybe it'll help

  • Why does my laptop have problems with USB card reader?

    I have a PowerBook G4, and I connect a multi-slot card reader to a USB port to read CompactFlash media. I have two problems with it and wonder if anyone can help.
    1) When I "eject" the media, then physically remove the media from the card reader, I occasionally get a "Media not removed properly" alert message. I always wait several seconds after the media icon has disappeared from the desktop before removing the media. I can't seem to reproduce this on demand, but it appears to be happening more frequently.
    2) Once the media has been removed from the card reader, the computer no longer recognizes it when it is reinserted into the card reader. I have to unplug the card reader from the USB port, then plug it back before the media is recognized.
    Any ideas how to resolve these issues?

    1) Wait longer. It can sometimes be necessary to wait as long as 15 seconds. I've never seen a good explanation of why.
    2) Are you plugging the reader directly into a USB port on the Powerbook? Are any other bus-powered USB devices connected simultaneously? If so, disconnect them and test again. If you have an AC-powered USB hub available (or can borrow one), try plugging that into the computer and the reader into the hub. (Don't use a bus-powered hub.)

  • Does anyone else have problems with iTunes 10.3.1 BETA?, Does anyone else have problems with iTunes 10.3.1 BETA?

    Installed iTunes 10.3.1 on Mac and then all tunes vanished from my iPhone 4.  I hooked the phone to the Mac and Synced them together and everything returned to iPhone.  Next morning the problem was back.  I had to delete iTunes and reinstall an older version from my Time Machine backup.  It now appears to be working.  Has anyone else had problems with this?

    This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes for Mac forums.
    BTW, iTunes 10.3.1 is not a beta release. Only the iTunes in the Cloud service is beta.
    Regards.

  • I have a new iPod touch and an iPad all my videos work on the iPod, but not on the iPad.  What am I doing wrong when I syn with iTunes ?

    iPad 2 does not show videos.  I just get a black screen when I hit the video app.  The videos show as being loaded when connected to iTunes. 

    I have the same problem - it is maddening. I rely on this iPad for work so this is not just an annoyance! The above solutions of changing the appleid on the device or on the website do not work.
    The old email address no longer exists - I haven't used it in a year probably and I no longer have the account.  I logged into the appleid website and there is no trace of the old email address so there is nothing that can be deleted or changed there.  On the iPad there is no trace of the old email address so nothing can be deleted there either. I have updated the iPad software and the same problem comes right back.  Every 2 seconds I am asked to log in using the old non-existent email.  The device is currently useless.
    The only recent change to anything was the addition of an Apple TV device, which was set up using the correct login and password.
    Does anyone have any ideas? The iPad has been backed up to the iCloud so presumably it now won't recognize the current iCloud account? So restoring may notbe an option?

  • Have just bought my youngest an Ipod - set up new user account on the computer, created a new email account.  However, cannot get this Ipod to connect to the Itunes store.  What am I doing wrong? Have spent hours on this!!!!

    have just bought my youngest an Ipod.  Have set up a new user accout as suggested by the man in the Apple store, got a separate email account and everything seemed ok.  HOwever, cannot get it to connec to the Itunes store so cannot redeem any vouchers.   I have now spent hours on this and am rapidly losing patience!  Can anyone help please.

    This may help.
    Can't connect to the iTunes Store
    What happens whenyou try to connect? Error messages?

  • Why does my iphone5 have problems with internet based apps and browsing after the 6.1.2 update?

    Hi,
    I am having major issues accessing the internet and loading web apps after the 6.1.2 update on my iphone 5.
    Anyone else having the same...have tried all th usual resets etc.
    So frustrating - why can't Apple test software releases properly!
    Vivek

    hi
    The problem is specifically on Wi-Fi, the apps that are persistently causing issues are:
    Safari
    Email
    Facebook
    Twitter
    You Tube
    The App store
    BBC Iplayer
    I keep restarting the phone which helps temporarily but then the Apps get timed out again. Looks like it cannot retrieve data over Wi-Fi.
    Thanks for your help so far.
    Vivek

  • Does anyone else have problems with iphone chargers breaking?

    I got my Iphone 5 in feburary. Since then I'm on my fourth charger. This is just insane. I am the proud owner of every generation ipad, 1 macbook, 2 imacs, 3 ipods, 2 apple tv's and obviously iphones. The iphone seems to be the only thing that breaks expect i had to spend $70 replacing the macbook charger once. My question is am I the only one having this problem. I talked to a couple people who had the same issue and even switched phones because of it..
    Today I was out spending another $20 on a cord. When I say break I mean you need to hold the charger cord in a certain angle for it to charge.. Apple needs to address this issue and come up with a new cord design.. My tracphone cords still work from 7 years ago...

    I'm not having problems.  However, if the basic troubleshooting steps outlined in the user guide (restart, reset, restore from backup, restore as new) fail to resolve your issue, then you have a hardware problem and you'll need to bring your phone into Apple for evaluation.

  • Does anyone else have problems with built in website url links in a PDF not working in iBooks?

    I have several magazine PDF files that have lots of website url links built in to them.
    When I click the links when viewing the PDFs via iBooks they often don't work.
    However, the exact same PDF when viewing/clicking using other PDF apps like GoodReader work perfectly fine.
    Nothing else is different except which app I am using to view the PDFs.
    Anyone?

    It would appear iBook app doesn't support hyperlinks except within a document.

  • Does any one have problems with verizon email ?  Mainly with email folders .

    I have an ipad2 and can not get any folder besides inbox and trash on my ipad .. It seems to be because I have to use yahoo.verizon server.. I have tried to sync the ipad several times but do not get folders that are on my Dell desktop running Windows 7.

    If the Verizon account is a POP account, then it will not sync folders from your PC. Those could just be local folders that your mail client lets you create on the computer. Those will not sync to the iPad.
    If you go to your email account in the Mail app and look at the window where your inbox, trash folder folders are - if there is an Edit button at the top of the window - tap that and then tap Add Mailbox at the bottom.
    If the Edit button is not there - you cannot create folders on the iPad. Your email account is not IMAP. Only IMAP email accounts can create folders on the iPad. Any folders that you would already have in an IMAP account would sync to the device as well.
    Why you are not seeing a sent folder is odd .... Have you sent email from this account yet?

  • I've changed my credit card info, and still have credit on my iTunes account, yet can't purchase anything. What am I doing wrong?

    IIce updated my credit card info. i have credits in my itune account, yet I can't buy anything. What am I doing wrong?

    Have you tried going to Settings>iTunes & App Store, and signing out? Click on your Apple ID, then on Sign Out. Then sign back in again and try again.
    Also, make sure you have closed the app: double-click the Home key and swipe up on it to close it. Then try again.
    Cheers,
    GB

Maybe you are looking for

  • Can't open iphoto after using My Publisher

    I recently made a book on My Publisher.  Now I can not open iphoto since it says it is already in use.  It seems as if all my pictures have been captured by My Publisher.  What can I do.

  • Case expression error with a select query in the condition

    Consider the two query below: 1. The first one use a case expression : select case when 3 > (select 1 from dual)*2 then 1 else 0 end from dual 2. The equivalent with a decode expression: select decode(sign(3-(select 1 from dual)*2),1,1,0) from dual T

  • Pl/sql block is too slow, should  procedure a better option

    Hi all, how to tune A PL/SQL block that traverse cursors and fetch millions of records then execute inserts in different tables, using execute immediate statement. It's too slow and takes 10 hours to populate 40 tables having millions of records, as

  • How do you share a photo album?

    OK I have a photo album in iPhoto.  How do you share that now that mobileMe is gone?  I want to be able to send a link to someone whether or not they have iCloud. I tried making a shared photoStream album, and it sort of works.  I can't re-order the

  • Thoughts about the bin window - bugs or features and workarounds...

    Hi there, I really have big toubles using the bin window. It is even worse in OSX.5 (the only thing I don't like with OSX.5 and Logic8!). There are some Problems: 1. I can't move any audio-files to wherever I want them to without Logic is copying the