/*............... Sample prog's 1.......................*/

using System;

class AgeValidation
{
int age;

void accept()
{
Console.WriteLine("Enter the Age:");
age=Convert.ToInt32(Console.ReadLine());
}
void display()
{
if(age<0)
{
Console.WriteLine("Invalid age");
}
else
{
Console.WriteLine("valid age");
}
}
public static void Main(String [] arg)
{
AgeValidation obj=new AgeValidation();
obj.accept();
obj.display();
}
}
/*................ end of sample prog 1...............*/


/*................sample prog 2..................*/

using System;

class MyTable
{
int t,i;
void accept()
{
Console.WriteLine("Enter the table number:");
t=Convert.ToInt32(Console.ReadLine());
}
void show()
{
for(i=1;i>0;i++)
{
Console.WriteLine("{0} * {1} = {2}",i,t,(i*t));
}
}

public static void Main(string [] arg)
{
MyTable obj=new MyTable();
obj.accept();
obj.show();
}
}

/*............. End of sample prog 2............*/

Newer Posts Older Posts Home