ODD One out Quiz

Sunday, 26 January 2014

Code of Program in C#

case 0: 
 int n, rem,s; 
 num2= Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text); 
 label4.Visible = true; 
 n = Convert.ToInt32(num2); 
 s = 0; 
 while (n > 0)
 {
 rem = n % 10; 
 s = (s * 10) + rem; // Comment:to check whether sum of two numbers contains zero or not 
 n = n / 10;
 if(rem==0)
 {
 textBox3.Text = ""; 
 label4.Text = "Sum of two Numbers Contains zero so answer cannot be displayed"; 
 break;
 } 
 else 
 { 
 textBox3.Text = Convert.ToString(num2);
 }
 }
 break;

No comments:

Post a Comment