//Write a program to calculate the distance travelled by reading speed and time.
using System;
class program
{
public static void Main()
{
int speed, time;
Console.WriteLine("Enter the Speed : ");
speed = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Time : ");
time = Convert.ToInt32(Console.ReadLine());
dist d = new dist();
d.distance(speed, time);
Console.Read();
}
}
class dist
{
public void distance(int speed,int time)
{
int distance;
distance = speed * time;
Console.WriteLine("Distance Travelled : " + distance);
}
}
using System;
class program
{
public static void Main()
{
int speed, time;
Console.WriteLine("Enter the Speed : ");
speed = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Time : ");
time = Convert.ToInt32(Console.ReadLine());
dist d = new dist();
d.distance(speed, time);
Console.Read();
}
}
class dist
{
public void distance(int speed,int time)
{
int distance;
distance = speed * time;
Console.WriteLine("Distance Travelled : " + distance);
}
}
No comments:
Post a Comment