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 are benefits and limitations of using Cookies? The benefits of using cookies for state management are as follows:- 1)    There is no server resources required as they a

What are the best practices while implementing globalization and localization? The best methods while developing international language support software are shown below:- 1)

Finding Maximum & Minimum Numbers - C# Program I am facing some problems in the code for Finding Maximum & Minimum Numbers. Can anybody suggest me the proper code for it.

read a file which has emp.no,name,age as per fields/you want to calculate no.of employess whose age more than50

Need to get a windows desktop application developed Project Description: I am looking to obtain a desktop application developed. The desktop application will have the subsequ

Explain Custom Activities. In addition to the standard activities available within the base activity library, you can make new activities to meet exact business needs. Creating

What are the different elements in Functions points? 1) Internal Logical Files (ILF): Following are some points to be noted for ILF:- The ILF are logically related d

I've some encrypted data list of customers that are stored in a sql server db. These data are encrypted using visual basic, using a specific dll, from what I could see. The work

Project Description: Program or Fan Page Poster for facebook fan pages. Major task of this program would be posting pictures on your facebook fan page from other users fan pa

Job Portal A one-stop explanation to all your needs. Consist of employee as well as employer login accounts. Employee capable to look for jobs. Employer capable to post jobs.