Professional Documents
Culture Documents
Muhammad Hashim Roll - No - 052 - IT
Muhammad Hashim Roll - No - 052 - IT
For
Enterprise Application Development
Semester IT 7th
Assignment No. 02
Name Muhammad Hashim
Roll No. 052
Course Instructor Mam Fanila
namespace Number_Is_Large_or_Equal
{
class Program
{
static void Main(string[] args)
{
int n;
int n1;
Console.WriteLine("Enter First Number");
n = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Second Number");
n1 = int.Parse(Console.ReadLine());
if (n > n1)
{
Console.WriteLine("First Number is Large");
}
else
if (n == n1)
{
Console.WriteLine("These Numbers are Equal");
} else
{
Console.WriteLine("Second Number is Larger");
}
Console.ReadKey();
}
}
}
Q.No:2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Diamond
{
class Program
{
static void Main(string[] args)
{
int S;
Console.WriteLine("Enter size of Diamond: ");
S = int.Parse(Console.ReadLine());
int x = 1;
Console.Write("*");
if (a > 0)
{
for (int c = 1; c <= x; c++)
{
Console.Write(" ");
}
x += 2;
Console.Write("*");
}
Console.WriteLine("");
}
x -= 4;
Console.Write("*");
if (a != S - 1)
{
Console.Write("*");
}
Console.WriteLine(""); ;
}
Console.ReadKey();
}
}
}
Q.No:3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Even_or_Odd
{
class Program
{
static void Main(string[] args)
{
int n;
Console.WriteLine("Enetr Any Number");
n = Convert.ToInt32(Console.ReadLine());
if (n% 2 == 0)
{
Console.WriteLine("The Number is Even");
}
else
{
Console.WriteLine("The Number is Odd");
}
Console.ReadKey();
}
}
}
Q.No:4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Five_Digit
{
class Program
{
static void Main(string[] args)
{
int n1,n2,n3,n4,n5;
int Sep;
n5 = Sep % 10;
n4 = (Sep / 10) % 10;
n3 = (Sep / 100) % 10;
n2 = (Sep / 1000) % 10;
n1 = (Sep / 10000) % 10;
Console.WriteLine("{0} {1} {2} {3} {4} ", n1, n2, n3, n4, n5);
Console.ReadLine();
}
}
}
Q.No:5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Escape_Sequence
{
class Program
{
static void Main(string[] args)
{
int counter = 0;
Console.WriteLine("N\t10*N\t100*N\t1000*N\n");
while (counter++ < 5)
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}", (counter), (counter*10),
(counter*100), (counter*1000));
}
Console.ReadKey();
}
}
}
Q.No:6
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace plaindrome
{
class Program
{
static void Main(string[] args)
{
int n, temp, remainder, rev = 0;
Console.WriteLine("Enter an integer:");
n = int.Parse(Console.ReadLine());
temp = n;
while (n > 0)
{
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
if (temp == rev)
{
Console.WriteLine("Number is a palindrome \n");
}
else
{
Console.WriteLine("Number is not a palindrome \n");
}Console.ReadKey();
}
}
}
Q.N0:7
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Factorial
{
class Program
{
public void fact()
{
int fac = 1;
Console.WriteLine("Enter Any Number:");
int num = int.Parse(Console.ReadLine());
while(num>=1 )
{
fac = fac * num;
num--;
}
Console.WriteLine(fac);
}
static void Main(string[] args)
{
Program pr = new Program();
pr.fact();
Console.ReadKey();
}
}
}
Q.No:8
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMI_Calculator
{
class Program
{
static void Main(string[] args)
{
int weight;
double height;
double bMI;
Console.ReadKey();
}
}
}
Q.No:9
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Half_pyramid
{
class Program
{
static void Main(string[] args)
{
}
Console.ReadKey();
}
}
}
Q.No:10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Half_Pyramid_Reverse
{
class Program
{
static void Main(string[] args)
{
}
}
}
Q.No:11
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Full_Pyramid
{
class Program
{
static void Main(string[] args)
{
Console.ReadKey();
}
}
}
Q.No:12
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Calculator2
{
class Program
{
static void Main(string[] args)
{
double result = 0;
int Operation = 0;
switch (Operation)
{
case '+':
result = firstNumber + secondNumber;
break;
case '-':
result = firstNumber - secondNumber;
break
;
case '*':
result = firstNumber * secondNumber;
break;
case '/':
result = firstNumber / secondNumber;
break;
default:
result = 0;
break;
}
Console.WriteLine("\nResult of " + firstNumber + " " + secondNumber + " = " +
result + " ");
Console.ReadKey();
}
}
}