Anik_Akash

579 - Clock Hands

May 21st, 2020
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main()
  4. {
  5.     double h, m;
  6.     double p1, p2, drg;
  7.     scanf("%lf:%lf", &h, &m);
  8.     if(h ==0 && m ==0)
  9.         return 0;
  10.     else {
  11.         p1 = ((h*30)+(m/2));
  12.         p2 = (m*6);
  13.         drg = p1-p2;
  14.         if(drg<0){
  15.             drg*=-1;
  16.         }
  17.  
  18.         if(drg>180){
  19.             drg = 360-drg;
  20.         }
  21.  
  22.         printf("%.3lf\n", drg);
  23.     }
  24.     return 0;
  25. }
RAW Paste Data