Pages

Write a program in C# and find the value of final velocity by using S= (〖Vf〗^2-〖Vi〗^2)/2a.

INPUT:

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication20
{   
class myclass
    {
        public double visquare(double vi)
        {
            double s = vi *vi;
            return s;
        }
        public double vfsquare(double vf)
        {
            double s = vf * vf;
            return s;
        }
        public double  s(double  vf,double vi)
    {
        double s = (vfsquare(vf) + visquare(vi)) / (2 * 9.98);
        return s;
    }
        static void Main(string[] args)
        {
            double vf,vi;
            Console.WriteLine("plz enter the final  velocity");
            vf=Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("plz enter the initial velocity ");
            vi= Convert.ToDouble(Console.ReadLine());
            myclass m = new myclass();
         
          Console.WriteLine("vf = (vi2+vf2)/2a = {0}",m.s(vf,vi));
        }  
    }
}

OUTPUT:


No comments:

Post a Comment