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. Addition

Addition

Scheduled Pinned Locked Moved C#
csharphelptutorial
9 Posts 5 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.
  • S Offline
    S Offline
    sardonicus
    wrote on last edited by
    #1

    simply i want to know how to add two integer numbers in C#. i'd appreciate your help guys.

    D 1 Reply Last reply
    0
    • S sardonicus

      simply i want to know how to add two integer numbers in C#. i'd appreciate your help guys.

      D Offline
      D Offline
      David Stone
      wrote on last edited by
      #2

      int firstInt = 3;
      int secondInt = 2;
      int result ;

      result = firstInt + secondInt; //result will be equal to 5

      The + operator will add together most any of your basic types: int, long, short, string, etc. Hope that helps. :)


      Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

      S 1 Reply Last reply
      0
      • D David Stone

        int firstInt = 3;
        int secondInt = 2;
        int result ;

        result = firstInt + secondInt; //result will be equal to 5

        The + operator will add together most any of your basic types: int, long, short, string, etc. Hope that helps. :)


        Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

        S Offline
        S Offline
        sardonicus
        wrote on last edited by
        #3

        but here you arleady assigned values to the two integers, what I need is to make a program that takes two input numbers from user and then adds them. thx a lot for ur reply anyway.

        E D 2 Replies Last reply
        0
        • S sardonicus

          but here you arleady assigned values to the two integers, what I need is to make a program that takes two input numbers from user and then adds them. thx a lot for ur reply anyway.

          E Offline
          E Offline
          eggie5
          wrote on last edited by
          #4

          Class abc { int a=System.Console.ReadLine(); int b=System.Console.ReadLine(); int c=a+b; } /\ |_ E X E GG

          1 Reply Last reply
          0
          • S sardonicus

            but here you arleady assigned values to the two integers, what I need is to make a program that takes two input numbers from user and then adds them. thx a lot for ur reply anyway.

            D Offline
            D Offline
            David Stone
            wrote on last edited by
            #5

            Well does it need to be a console application or a Windows Forms application? Or even an ASP.NET application? The basic principle remains the same...it's just a matter of gathering that input from the user.


            Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

            B 1 Reply Last reply
            0
            • D David Stone

              Well does it need to be a console application or a Windows Forms application? Or even an ASP.NET application? The basic principle remains the same...it's just a matter of gathering that input from the user.


              Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

              B Offline
              B Offline
              benjymous
              wrote on last edited by
              #6

              How about voice recognition? That'd be cool :) -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

              N 1 Reply Last reply
              0
              • B benjymous

                How about voice recognition? That'd be cool :) -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

                N Offline
                N Offline
                Nnamdi Onyeyiri
                wrote on last edited by
                #7

                Even better, thought recognition. The ultimate lazy mans computer.


                website // Project : AmmoITX //profile Another Post by NnamdiOnyeyiri

                B 1 Reply Last reply
                0
                • N Nnamdi Onyeyiri

                  Even better, thought recognition. The ultimate lazy mans computer.


                  website // Project : AmmoITX //profile Another Post by NnamdiOnyeyiri

                  B Offline
                  B Offline
                  benjymous
                  wrote on last edited by
                  #8

                  It looks like you want to add two numbers Would you like help?

                  • Get help thinking of a number
                  • Just carry on adding without help

                  Oh god... -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

                  D 1 Reply Last reply
                  0
                  • B benjymous

                    It looks like you want to add two numbers Would you like help?

                    • Get help thinking of a number
                    • Just carry on adding without help

                    Oh god... -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

                    D Offline
                    D Offline
                    David Stone
                    wrote on last edited by
                    #9

                    And since it's a thought computer, the thing is going to project an image of Clippy directly into my optical nerves. Great. :rolleyes:


                    Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

                    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