Source code
#include <iostream>
using namespace std;
int main()
{
int speed1=72;
int speed2=54;
int X;
cout<<"\nEnter number of seconds: ";
cin>>X;
//convert seconds into hours
float X2=X/3600.0;
float distance=(speed1+speed2)*X2;
cout<<"\nThe length of the goods train = "<<distance;
return 0;
}
Output
Comments
Leave a comment