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. Web Development
  3. ASP.NET
  4. Sum Integer Values [modified]

Sum Integer Values [modified]

Scheduled Pinned Locked Moved ASP.NET
databasequestion
5 Posts 3 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.
  • M Offline
    M Offline
    Mr Wonderful
    wrote on last edited by
    #1

    Hi all, I need to make function that recieve any number from textbox and return the sum of this number without convert this number to string to dealing with it's index and get the sum, So the Number 2543 will return 14 So My Question is : what's the other way to Get Sum of number without converting to string, Bytheway the function will recieve integer and return integer. Regards Mr.Wonderful

    modified on Tuesday, June 3, 2008 10:18 AM

    C 1 Reply Last reply
    0
    • M Mr Wonderful

      Hi all, I need to make function that recieve any number from textbox and return the sum of this number without convert this number to string to dealing with it's index and get the sum, So the Number 2543 will return 14 So My Question is : what's the other way to Get Sum of number without converting to string, Bytheway the function will recieve integer and return integer. Regards Mr.Wonderful

      modified on Tuesday, June 3, 2008 10:18 AM

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Mr. Wonderful wrote:

      I need to make function that recieve any number from textbox and return the sum of this number without convert this number to string to dealing with it's index and get the sum, So the Number 2543 will return 11

      That makes no sense. If the number is coming from a test box then it already is a string.

      Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

      M 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Mr. Wonderful wrote:

        I need to make function that recieve any number from textbox and return the sum of this number without convert this number to string to dealing with it's index and get the sum, So the Number 2543 will return 11

        That makes no sense. If the number is coming from a test box then it already is a string.

        Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

        M Offline
        M Offline
        Mr Wonderful
        wrote on last edited by
        #3

        Ok, No Problem.. Suppose there is no textbox and you fill the function manually, thats mean you write the number direct to the function, How the Solution Could Be.

        Y 1 Reply Last reply
        0
        • M Mr Wonderful

          Ok, No Problem.. Suppose there is no textbox and you fill the function manually, thats mean you write the number direct to the function, How the Solution Could Be.

          Y Offline
          Y Offline
          Yusuf
          wrote on last edited by
          #4

          Mr. Wonderful wrote:

          Ok, No Problem.. Suppose there is no textbox and you fill the function manually, thats mean you write the number direct to the function, How the Solution Could Be.

          To begin with, in your OP you stated the number coming from input field. As colin pointed out you will need to address that issue first. If you want to add add the digits of all numbers then you can use mod and divide to dissect each digit and get the sum of each. Here is an example.

          Yusuf

          modified on Wednesday, June 4, 2008 9:21 AM

          M 1 Reply Last reply
          0
          • Y Yusuf

            Mr. Wonderful wrote:

            Ok, No Problem.. Suppose there is no textbox and you fill the function manually, thats mean you write the number direct to the function, How the Solution Could Be.

            To begin with, in your OP you stated the number coming from input field. As colin pointed out you will need to address that issue first. If you want to add add the digits of all numbers then you can use mod and divide to dissect each digit and get the sum of each. Here is an example.

            Yusuf

            modified on Wednesday, June 4, 2008 9:21 AM

            M Offline
            M Offline
            Mr Wonderful
            wrote on last edited by
            #5

            Thanks a lot it was very Useful Site. Mr.Wonderful

            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