none
how to add value in a previous value using visual c# RRS feed

  • Question

  • Hi,

    I am using visual 2012 C#. how to add two values and also add up previous one value like

    op1=0;

    op1=1;

    result=op1+op2;

    it gives result =1

    and then we want to add in a result further value then how to do. but it is done for windows 8.help me out in this regard. how a new value add in a previous one. 

    Saturday, November 3, 2012 5:27 PM

Answers

  • Hi,

    add the new value to the result, like:

    int op1=0;
    op1=1;
    int op2 = 2;
    result = op1 + op2;
    
    //new Value
    int newValue = 5;
    result += newValue;
    
    Console.WriteLine(result.ToString());

    Regards,

      Thorsten
    • Proposed as answer by Adavesh Monday, November 5, 2012 5:17 AM
    • Marked as answer by Mike FengModerator Thursday, November 8, 2012 10:58 AM
    Saturday, November 3, 2012 5:56 PM