Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to do "123=6 23567=23"???

how to do "123=6 23567=23"???

Scheduled Pinned Locked Moved C#
tutorialhelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gursucan
    wrote on last edited by
    #1

    i need a program that sums the number values of a nuber for example: when i enter the number 12345 it sums numbers values 1+2+3+4+5=15.. pls help.... also tnx for ur helps

    G L L 3 Replies Last reply
    0
    • G gursucan

      i need a program that sums the number values of a nuber for example: when i enter the number 12345 it sums numbers values 1+2+3+4+5=15.. pls help.... also tnx for ur helps

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Loop through the characters in the string, convert each character to a number, and add them together. --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • G gursucan

        i need a program that sums the number values of a nuber for example: when i enter the number 12345 it sums numbers values 1+2+3+4+5=15.. pls help.... also tnx for ur helps

        L Offline
        L Offline
        Lju2
        wrote on last edited by
        #3

        Or divide with 10 until you get to zero... num=next%10; sum+=num; next=next/10;

        1 Reply Last reply
        0
        • G gursucan

          i need a program that sums the number values of a nuber for example: when i enter the number 12345 it sums numbers values 1+2+3+4+5=15.. pls help.... also tnx for ur helps

          L Offline
          L Offline
          Luis Alonso Ramos
          wrote on last edited by
          #4

          We won't do your homework for you. You've already received two answers with different suggestions, but if you need more help, try yourself before, and then post the code telling us what exact problem you are having. -- LuisR


          Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

          The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups