using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
Console.Write("Input starting velocity (m/s):");
string str = Console.ReadLine();
float fs = int.Parse(str);
Console.Write("Input ending velocity (m/s):");
str = Console.ReadLine();
float es = int.Parse(str);
Console.Write("Input time span (s):");
str = Console.ReadLine();
float ts = int.Parse(str);
if (ts == 0)
{
Console.WriteLine("Bad number 'time span'.");
return;
}
float res = (es - fs) / ts;
Console.WriteLine("Average acceleration (m/s^2): {0:F3}", res);
}
catch
{
Console.WriteLine("Bad number");
return;
}
}
}
}
Comments
Leave a comment