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
How can we get the state of the requested process? XMLHttpRequest get the current state of the request operation by using the readyState property. This property checks the cond

I need CloudFlare API interface to C# Project Description: We require a small piece of C# .NET code, integrated in an object, that will interface with CloudFlare's API and ge

What is DCOM? DCOM is different from COM in that it allows for creating objects distributed around  a network, and a protocol for invoking that object's methods, & secures the

Explain the new features in ADO.NET Entity Framework 4.0. ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and contain the following new features: Persisten

hello,i want to ask that i have to make a test taker just like a quiz in vb.net which should b like mcq''z one...it must contain a connectivity with database of oracle or MS access

What are the components of WF 4.0? WF having of various components that work together to make desired workflow. The components of WF are given as follows: Workflows and a

What is the difference between proc. sent BY VAL and By Ref? By val: changes will not be reflected back to the variable. By ref: changes will be reflected back to that varia

What is Multi-threading? Multi-threading process forms the subset of Multi-tasking. Inspite of having to switch between programs this feature switches between different parts o

What is a gateway or Router? A node that is linked to two or more networks is commonly called as router or Gateway. It generally forwards message from single network to another

What are the different types of literals? A literal is a textual representation of an exacting value of a type. The dissimilar types of literals in Visual Basic are: Boo