C# Questions Answers- basic syntax


C# basic syntax

1. Find any errors in the following C# program:
namespace ConsoleApplication1{
  class Program{
     static void Main(string[] args){ /* This is the main function
          Console.WriteLine('C# Programming questions and answers');

     }
   }
}
Check answer 2. Find any errors in the following C# program:
using System;
namespace ConsoleApplication1{
  class Program{
     static void Main(string[] args){
        integer a;
        float b;

      }
   }
}
Check answer 3. Find any errors in the following C# program:
using System;
namespace ConsoleApplication1{
  class Program{
     static void Main(string[] args){
             //This is another C# program with some errors
         a,b,s int;
         d float;
         Console.WriteLine("The end of the program");
        
    }
  }
}
Check answer 4. What is the output from the following C# program?
using System;
namespace ConsoleApplication1{
  class Program{
     static void Main(string[] args){
        int a,b,sum,subtr;
        a=100;
        b=20;
        sum=a+b;
        subtr=a-b;
       
        Console.WriteLine("{0}\t{1}","a+b","a-b");
        Console.WriteLine("{0}\t{1}",sum,subtr);
        }
    }
}

Check answer


Comments

nada comment

 nada

Console.WriteLine("enter the plane speed");
float s = float.Parse(Console.ReadLine());
Console.WriteLine("enter the plane length");
float l = float.Parse(Console.ReadLine());

if (s >= 1100)

Console.WriteLine("plane for travel");
if (l < 52)

Console.WriteLine("military");
else
Console.WriteLine("clivien");

else
Console.WriteLine("plane not travel");


2016-01-14
CAPTCHA image



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.