Computer Science, asked by aarnavarora25, 1 month ago

Write a program to find the speed of moving vehicle (Speed=distance/time)

Answers

Answered by kiaaa069
1

Answer:

Here is the Java program for the question you have asked!

Explanation:

import java.util.Scanner;

class CalculateDistance

{

public static void main(String args[])

{

 

double speed,distance,time;

       

Scanner sc=new Scanner(System.in);

 

System.out.println("enter distance in kms ");

 

distance=sc.nextDouble();  

 

System.out.println("enter time in hours ");

 

time=sc.nextDouble();  

 

speed= distance/time;

 

System.out.println("Speed= "+speed+"kmph");

 

 

 

 

}

}

Similar questions