Q10) Modify the program of first
question by taking the speed and time from the user as input.
#include <iostream>
using namespace std;
int main()
{
float speed,distance,time;
cout<<"Enter speed = ";
cin>>speed;
cout<<"Enter time = ";
cin>>time;
distance=time*speed;
cout<<"The distance = "<<distance<<endl;
return 0;
}
using namespace std;
int main()
{
float speed,distance,time;
cout<<"Enter speed = ";
cin>>speed;
cout<<"Enter time = ";
cin>>time;
distance=time*speed;
cout<<"The distance = "<<distance<<endl;
return 0;
}
No comments:
Post a Comment