This Program Is To Swap Two Integers // Kindly Change The Variable Names Before Copying The Program in Your Files
This Program Is To Swap Two Integers // Kindly Change The Variable Names Before Copying The Program in Your Files
This Program Is To Swap Two Integers // Kindly Change The Variable Names Before Copying The Program in Your Files
using System.Collections.Generic;
using System.Linq;
using System.Text;
// this program is to swap two integers
// KINDLY CHANGE THE VARIABLE NAMES BEFORE COPYING THE PROGRAM IN YOUR FILES
namespace file_program_day2
{
class Program
{
static void Main(string[] args)
{
int a, b, temp;
Console.WriteLine("Enter any two numbers ");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.Write("Numbers before swapping are ");
Console.Write(a);
Console.Write(" and ");
Console.WriteLine(b);
temp = a;
a = b;
b = temp;
Console.Write("Numbers after swapping are ");
Console.Write(a);
Console.Write(" and ");
Console.WriteLine(b);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
////////////////////////////// program to check greatest integer aming three
///////////////////////////// KINDLY CHANGE THE VARIABLE NAMES BEFORE COPYING THE PROGRAM
IN YOUR FILES
namespace file_program1_day2
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
Console.Write("Enter any three integers ");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = int.Parse(Console.ReadLine());
if (a > b && a > c)
{
Console.Write("Greatest integer is ");
Console.WriteLine(a);
}
else if (b > c && b > a)
{
Console.Write("Greatest integer is ");
Console.WriteLine(b);
}
else
{
Console.Write("Greatest integer is ");
Console.WriteLine(c);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//////////////////// program to find armstrong number upto 500
//////////////////// KINDLY CHANGE THE VARIABLE NAMES BEFORE COPYING THE PROGRAM IN YOUR
FILES
namespace file_program2_day2
{
class Program
{
static void Main(string[] args)
{
int t, h, i, tr, hr, num;
for (i = 1; i <= 500; i++)
{
h = i / 100;
hr = i % 100;
t = hr / 10;
tr = hr % 10;
num = (h*h*h)+(t*t*t)+(tr*tr*tr);
if (num == i)
{
Console.Write("Armstrong number is ");
Console.WriteLine(num);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/////////////// this program is to display fibonacci series upto 'n' term
/////////////// KINDLY CHANGE THE VARIABLE NAMES BEFORE COPYING THE PROGRAM IN YOUR FILES
namespace file_program3_day2
{
class Program
{
static void Main(string[] args)
{
int n, first = 0, second = 1, next, c;
Console.WriteLine("Enter the number of terms");
n = int.Parse(Console.ReadLine());
Console.Write("First ");
Console.Write(n);
Console.WriteLine(" terms of Fibonacci series are :-");
for (c = 0; c < n; c++)
{
if (c <= 1)
next = c;
else
{
next = first + second;
first = second;
second = next;
}
Console.WriteLine(next);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace check1
{
class Program
{
static void Main(string[] args)
{
int i;
Console.Write("Enter a Number : ");
i = int.Parse(Console.ReadLine());
if (i % 2 == 0)
{
Console.Write("Entered Number is an Even Number");
Console.Read();
}
else
{
Console.Write("Entered Number is an Odd Number");
Console.Read();
}
}
}
}
http://chenyichun0407.wordpress.com/2010/05/19/visual-studio-2010-installation-step-by-step/