1-Program To Addition, Subtraction, Multipication, Division: Output
1-Program To Addition, Subtraction, Multipication, Division: Output
1-Program To Addition, Subtraction, Multipication, Division: Output
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace add_mul_sum_div
{
class Program
{
static void Main(string[] args)
{
int a, b;
a = 10;
b = 4;
Console.WriteLine("Addition={0}", a + b);
Console.WriteLine("Subtraction={0}", a - b);
Console.WriteLine("Multiply={0}", a * b);
Console.WriteLine("Division={0}",(float)a / b);
}
}
}
Output :
Output :
Output :
Output :
Output :
6 PROGRAM TO FACTORIAL OF N
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dynamic_Factorial
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the number: ");
int a = Convert.ToInt32(Console.ReadLine());
int result= fact(a);
Console.WriteLine("Factorial of the number is: " + result);
}
static int fact(int b)
{
if(b <= 1)
return 1;
else
return b * fact(b-1);
}
}
}
Output :
7 PROGRAM TO TRAINGALE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Triangle
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the charecter\n");
string str1 = Console.ReadLine();
int i = 0;
char[] arr = new char[10];
foreach (char s in str1)
arr[i++] = s;
for (i = 0; i < str1.Length; i++)
{
for (int j = 0; j <= i; j++)
Console.Write(arr[j]);
Console.ReadLine();
}
}
}
}
Output :
Console.Write(j);
}
Console.WriteLine();
}
}
}
class Program
{
static void Main(string[] args)
{
C obj = new C();
obj.Nand();
obj.Saxena();
obj.Bramha();
Console.Read();
}
}
}
Output :
9 PROGRAM TO INTERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace interface_me
{
interface A
{
void me();
}
interface B
{
void show();
}
class C : B, A
{
public void me()
{
Console.WriteLine("I LOVE MY India");
}
public void show()
{
Console.WriteLine("My Name is B.N.Saxena");
}
}
class Program
{
static void Main(string[] args)
{
C obj = new C();
obj.me();
obj.show();
Console.Read();
}
}}
Output :
10
Output :
11