Submarine
Given two numbers
The sequence of operations is,
Sample Input 1
5
2
Sample Output 1
Submarine Submerged
2 Torpedos Fired, 3 Left
Submarine Surfaced
Sample Input 2
10
2
Sample Output 2
Submarine Submerged
2 Torpedos Fired, 8 Left
Submarine Surfaced
function submarine(totalTorpedos, torpedosFired) {
console.log('Submarine Submerged');
console.log(`${torpedosFired} Torpedos Fired, ${totalTorpedos - torpedosFired} Left`);
console.log('Submarine Surfaced');
}
submarine(10, 2);
Comments
Leave a comment