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 shadowing? When 2 elements in a program have similar name, one of them can hide and shadow the one. Therefore in such cases the element which shadowed the main element

It's never told  to distribute complete implementation at client, due to following shown  reasons:- 1) Anyone can use ILDASM and decrypt your logic. 2) It is a bad architectu

Audio Expert in C# Required - Generate Audio Engine, Exciting Project! Project Description: We need an EXPERT CODER to help us create an 'audio engine' in C#. We need to b

im retrieving the path of image from the database i want to get the image in that path to be displayed in my datagridviewvolumn

I need a program that mimics the similar functionality as the link below. Program must have a unique user interface. Must add source code, installer, and of course a nice user i

What's the use of resource manager class? The ResourceManager class helps us to read the resource files and get the values by using key. At First you require to create the obje

How can you increase SQL performance? 1)Keep your indexes as narrow as possible. This reduces the size of the index and decrease the number of reads needed to read the index.

Webservices as such do not have any mechanism by which they can maintain their state. The Webservices can access ASP.NET intrinsic objects such as application, session and many mor

Explain in brief DataAdapter class in ADO.NET. The DataAdapter class retrieves data from the database, keeps data in a dataset, and reflects the changes made in the dataset to

Passport authentication A centralized service given by Microsoft, offers a single logon point for clients. Unauthenticated users are redirected to the Passport site