Program of addition of byte type variables – c# program, DOT NET Programming

Program of addition of byte type variables - C# Program

Program of addition of byte type variables, i need program code for performing addition of byte type variables. Can anybody send me there ideas?

Posted Date: 2/11/2013 5:56:31 AM | Location : United States





Yes, i have an example regarding your problem you specified above. Try this it is beneficial for you.

Program - addition of byte type variables

using System; 

class addition 

          public static void Main() 

               { 

                  byte b1; 

                  byte b2; 

                  int b3; // We are required to declare b3 as byte BUT its declared as int. The reason is given below. 

                  b1 = 100; 

                  b2 = 200; 

             // Normally this is the addition statement  

            //        b3 = b1 + b2; 

           // However it gives an error that cannot convert ''int'' to ''byte''. 

           // When b2 & b3 are added, we get an integer value which cannot be stored in byte b1 

           // Thus we will declare b3 as integer type & explicitly convert b2 & b3 to int. 

                 b3 = (int)b1 + (int)b2; 

                 Console.WriteLine("b1 = " + b1);  

                 Console.WriteLine("b2 = " + b2); 

                 Console.WriteLine("b3 = " + b3); 

                 Console.ReadLine(); 

              } 

}

Posted by Alice | Posted Date: 2/11/2013 5:58:40 AM

Thank you, for your expert advice. You have described very useful code.

Posted by Jermy | Posted Date: 2/11/2013 6:02:12 AM


Related Discussions:- Program of addition of byte type variables – c# program, Assignment Help, Ask Question on Program of addition of byte type variables – c# program, Get Answer, Expert's Help, Program of addition of byte type variables – c# program Discussions

Write discussion on Program of addition of byte type variables – c# program
Your posts are moderated
Related Questions
What is Asynchronous One-Way Calls The One-way calls are a different from the asynchronous calls by the execution angle that the .NET Framework does not assure their execution.

What is the difference among a toolstrip drop-down button and a toolstrip split button? The difference among a toolstrip drop-down button and a toolstrip split button is that a

I want help to update and customize existing POS system Project Description: We have pharmacy chain stores with existing POS system linked via VPN to server with local user o

having trouble programming

What are Value types and Reference types The Value types directly contain their data which are either allocated on the stack or allocated in-  Line in a  structure. The Refe

How can we implement singleton pattern in .NET ? The Singleton pattern basically focuses on having one and only one instance of the object running. Lets take an e.g. a windows

What is managed code and managed data? Managed code is code that is written to target the services of the Common Language Runtime. In order to target these services, the code m

Describe the XmlWriter class. The XmlWriter class is used to write XML to a stream, a file, or a Textwriter object. This class works in a forward-only, non-cached manner. You c

Requirements: 1.  Complete the following two exercises by developing working csharp projects. 2.  Write a report to explain csharp code written in the projects. 3.  Submi

i want decompile ex5 files Project Description: i want decompile some ex5 files like indicators, scripts and eas i need in format mq5 can do this to me? Skills required