Canna

Sunday, 23 September 2018

TIME CONVERSION

Problem Description

Harshas teacher give one assignment to him. He should write a code to find the time entered in hours,seconds and minutes into seconds. Help him to solve this task.

  • Test Case 1

    Input (stdin)
    2 30 4
    
    
    Expected Output
    9004
  • Test Case 2

    Input (stdin)
    10 5 60
    
    
    Expected Output
    36360
  • Program
  • #include <stdio.h>
    int main()
    {
    int h, m, s, n;
      scanf("%d%d%d", & h, & m, & s) ;
      n=((h*60*60)+(m*60)+s);
      printf ("%d", n) ;
     return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.