Skip to content
Related Articles

Related Articles

Improve Article
Time when minute hand and hour hand coincide
  • Difficulty Level : Basic
  • Last Updated : 09 Mar, 2021

Given time in hours, find the time in minute at which the minute hand and hour hand coincide in next one hour.
Examples : 
 

Input : 3 
Output : (180/11) minutes

Input :7
Output : (420/11) minutes

 

Approach : 
1. Take two variables for hour “h1 and h2” and then find the angle “theta” [theta = (30 * h1)] and then divide it by “11” to find the time in minute(m). We are dividing with 11, because the hands of a clock coincide 11s time in 12 hours and 22 times in 24 hours :
Formula : This can be calculated using the formula for time h1 to h2 means [11m / 2 – 30 (h1)] 
this implies [ m = ((30 * h1) * 2) / 11 ] ] 
[ m = (theta * 2) / 11 ] 
where [theta = (30 * h1) ]
where A and B are hours i.e if given hour is (2, 3) then A = 2 and 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>
Output : 
(180/11) minutes

 

Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :