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
Define importance of Vitamin c Freezing preserves vegetable and nutrients to a great extent. Vitamin A and β-Carotene are well preserved in spinach, peas and beans, or are mode

I want to develop SMS application with auto reply based on the content of the message using gsm modem. eg.Student results checking using cell phone via sms. How do i do this?


What is Common Type System (CTS)? CTS is the component of CLR by which .NET Framework provides support for multiple languages because it have a type system that is common acros

What is normalization & what are the types of normalization? Normalization is a set of rules that have been established to aid in the design of tables that are meant to be conn

What is Windows Workflow Foundation (WF)? Windows Workflow Foundation (WF) is a technology that was first introduced in .NET Framework 3.0. WF having of a programming model, a

13579 3579 579 79 9 How to the logic in code. pls give me Ans.

What is impersonation in ASP.NET? By default, the ASP.NET executes in the security context of a restricted user account on the local machine. Sometimes you require to access ne

Project Description: We are seeking Mobile game developer for long time our budget is per project Skills required: Mobile Phone, .NET

Design an interface and add code to command buttons using case statement, to find coursework to be calculated using formula 0.6*1/6*total Mark