Dado el tiempo en horas, encuentre el tiempo en minutos en el que el minutero y el horario coinciden en la siguiente hora.
Ejemplos:
Input : 3 Output : (180/11) minutes Input :7 Output : (420/11) minutes
Enfoque:
1. Tome dos variables para la hora «h1 y h2» y luego encuentre el ángulo «theta» [theta = (30 * h1)] y luego divídalo por «11» para encontrar el tiempo en minutos (m). Estamos dividiendo con 11, porque las manecillas de un reloj coinciden 11 segundos en 12 horas y 22 veces en 24 horas:
Fórmula: Esto se puede calcular usando la fórmula para el tiempo h1 a h2 significa [11m / 2 – 30 (h1)]
esto implica [m = ((30 * h1) * 2) / 11 ] ]
[ m = (theta * 2) / 11 ]
donde [theta = (30 * h1) ]
donde A y B son horas, es decir, si la hora dada es (2, 3) entonces A = 2 y B = 3 .
C++
// CPP code to find the minute at which // the minute hand and hour hand coincide #include <bits/stdc++.h> using namespace std; // function to find the minute void find_time(int h1) { // finding the angle between minute // hand and the first hour hand int theta = 30 * h1; cout << "(" << (theta * 2) << "/" << "11" << ")" << " minutes"; } // Driver code int main() { int h1 = 3; find_time(h1); return 0; }
JAVA
// Java code to find the minute // at which the minute hand and // hour hand coincide import java.io.*; class GFG { // function to find the minute static void find_time(int h1) { // finding the angle between // minute hand and the first // hour hand int theta = 30 * h1; System.out.println("(" + theta * 2 + "/" + " 11 ) minutes"); } //Driver Code public static void main (String[] args) { int h1 = 3; find_time(h1); } } // This code is contributed by // upendra singh bartwal
Python3
# Python3 code to find the # minute at which the minute # hand and hour hand coincide # Function to find the minute def find_time(h1): # Finding the angle between # minute hand and the first # hour hand theta = 30 * h1 print("(", end = "") print((theta * 2),"/ 11) minutes") # Driver code h1 = 3 find_time(h1) # This code is contributed by # Smitha Dinesh Semwal
C#
// C# code to find the minute // at which the minute hand // and hour hand coincide using System; class GFG { // function to find the minute static void find_time(int h1) { // finding the angle between minute // hand and the first hour hand int theta = 30 * h1; Console.WriteLine("(" + theta * 2 + "/" + " 11 )minutes"); } //Driver Code public static void Main() { int h1 = 3; find_time(h1); } } // This code is contributed by vt_m.
PHP
<?php // PHP code to find the minute // at which the minute hand and // hour hand coincide // function to find the minute function find_time($h1) { // finding the angle between // minute hand and the first // hour hand $theta = 30 * $h1; echo("(" . ($theta * 2) . "/" . "11" . ")" . " minutes"); } // Driver code $h1 = 3; find_time($h1); // This code is contributed by Ajit. ?>
Javascript
<script> // JavaScript code to find the minute at which // the minute hand and hour hand coincide // function to find the minute function find_time(h1) { // finding the angle between minute // hand and the first hour hand theta = 30 * h1; document.write("(" + (theta * 2) + "/" + "11" + ")" + " minutes"); } // Driver code h1 = 3; find_time(h1); // This code is contributed by Surbhi Tyagi. </script>
(180/11) minutes
Publicación traducida automáticamente
Artículo escrito por prabhat kumar singh y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA