Coding unit 7

Task 1

using System;

public class Exercise1

{

public static void Main()

{

System.Console.WriteLine(“Hello”);

Task 2

    System.Console.WriteLine("Ibraheem Afzal!"); 

  System.Console.WriteLine(15+17); 

  System.Console.WriteLine(36/6); 

  System.Console.WriteLine(-1+4*6); 

  System.Console.WriteLine((35+5)%7); 

  System.Console.WriteLine(14+-4*6/11);  

  System.Console.WriteLine(2+15/6*1-7%2); 

}

}

Task 3

using System;

public class Test

{

public static void Main()

{

int numberBox;

numberBox=22;

Console.WriteLine(numberBox);

Console.WriteLine(“The value in numberBox = {0}”,numberBox);

}

}

Task 4

using System;

public class Test

{

public static void Main()

{

int numberBox;

int numberBox2;

numberBox=22;

numberBox2=44;

Console.WriteLine(numberBox);

Console.WriteLine(numberBox2);

Console.WriteLine(“The sum of {0} + {1} = {2}”,numberBox, numberBox2, (numberBox+numberBox2));

// {0} {1} {2}

}

}

using System;

public class Test

{

public static void Main()

{

int numberBox;

int numberBox2;

numberBox=Convert.ToInt32( Console.ReadLine() );

numberBox2=Convert.ToInt32( Console.ReadLine() );

Console.WriteLine(numberBox);

Console.WriteLine(numberBox2);

Console.WriteLine(“The sum of {0} + {1} = {2}”,numberBox, numberBox2, (numberBox+numberBox2));

                                             {0}         {1}              {2} 

using System;

public class Test

{

public static void Main() 

{ 

    Console.Write("Enter a number: "); 

    int num1= Convert.ToInt32(Console.ReadLine()); 



    Console.Write("Enter another number: "); 

    int num2= Convert.ToInt32(Console.ReadLine()); 



    Console.WriteLine("{0} + {1} = {2}", num1, num2, num1+num2); 

    Console.WriteLine("{0} - {1} = {2}", num1, num2, num1-num2); 

    Console.WriteLine("{0} x {1} = {2}", num1, num2, num1*num2); 

    Console.WriteLine("{0} / {1} = {2}", num1, num2, num1/num2); 

    Console.WriteLine("{0} mod {1} = {2}", num1, num2, num1%num2); 





}    

}

using System;

public class Test

{

public static void Main() 

{ 

    int age; 

    Console.Write("Enter your age "); 

    age = Convert.ToInt32(Console.ReadLine()); 

    Console.Write("You look younger than {0} ",age); 

} 

}