Question1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int age;
int a, b, c;
Console.WriteLine("Enter your Current Age");
age= Convert.ToInt32(Console.ReadLine());
if (age < 18)
{
Console.WriteLine("You are a Child");
}
else if (18 <=age)
{
Console.WriteLine("You are Adult");
}
else
{
Console.WriteLine("You are a Child");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int age;
int a, b, c;
Console.WriteLine("Enter your Current Age");
age= Convert.ToInt32(Console.ReadLine());
if (age < 18)
{
Console.WriteLine("You are a Child");
}
else if (18 <=age)
{
Console.WriteLine("You are Adult");
}
else
{
Console.WriteLine("You are a Child");
}
Console.ReadKey();
}
}
}
Question2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
int a;
for (a = 1; a <=100 ;a++ )
{
if (a % 2 !=0 && a % 3 != 0 && a % 5 != 0)
{
Console.WriteLine("{0}",a);
}
}
Console.ReadKey();
}
}
}
Question3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a;
for (a = 0; a <= 255; a++)
{
Console.WriteLine("{0} --->{1}", a,Convert.ToChar(a));
}
Console.ReadKey();
}
}
}
Question4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int a;
int b;
int c;
Console.WriteLine("what your want to do *,+,-,/ select one");
c = Convert.ToChar(Console.ReadLine());
Console.WriteLine("Enter First Number");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Second Number");
b = Convert.ToInt32(Console.ReadLine());
switch (c)
{
case '*':
c = a * b;
Console.WriteLine("The Mul of a and b {0}", c);
break;
case '+':
c = a + b;
Console.WriteLine("The sum of a & b {0}", c);
break;
case '-':
c = a - b;
Console.WriteLine("The difference of a & b {0}", c);
break;
case '/':
c = a / b;
Console.WriteLine("The quotient of a & b {0}", c);
break;
}
Console.ReadKey();
}
}
}
Question5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
int a;
int b;
Console.WriteLine("Enter Number for Table");
a = Convert.ToInt32(Console.ReadLine());
for (b = 1; b <= 10; b++)
{
Console.WriteLine("{0}X {1}={2}",a, b,a*b);
}
Console.ReadKey();
}
}
}