Help Me Please 😭😭😭😭 | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Help Me Please 😭😭😭😭

You need to plan a road trip. You are traveling at an average speed of 40 miles an hour. Given a distance in miles as input (the code to take input is already present), output to the console the time it will take you to cover it in minutes. Sample Input: 150 Sample Output: 225

28th Dec 2021, 3:59 PM
Shohidul Islam
Shohidul Islam - avatar
2 Réponses
+ 4
Shohidul remember that pure knowledge of programming language syntax is not enough to solve real problems. You need to also have an insight into a domain of a problem you want to solve. Do you know the average speed formula? Do you know how to transform the speed equation to solve for any of it's variables? You can copy the solution given here and get a "hooray you did it" message, but what's the point? Say you get other assignment where you'll need to calculate the circuit's resitance based on given voltage and current. You still going to ask here, each time new problem arises? Research the domain of the problem you are solving. Programming is just the final step of solving the problem, most of it is carefully analysing it.
28th Dec 2021, 4:44 PM
Nick
+ 1
I did it in C++: int main(){ float distance; cin>>distance; /*You declare a variable, and make the user input it*/ cout<<distance/40*60; /*And here it’s just math*/ } that’s it. btw, you can add some other things to output to the user, like ‘Enter the distance here:’, or ‘Here’s the time it would take:’.
28th Dec 2021, 4:27 PM
Ropphy
Ropphy - avatar