0 like 0 dislike
5.3k views
時鐘上有時針有分針,分針每一分鐘跳一次,分針每跳一次時針也會前進相對應的角度。請設計一程式,由使用者輸入一個時間,程式會計算出時針與分針間的夾角後輸出。

輸入說明:輸入包含兩個正整數,兩個數之間由一個空白隔開,第一個數字代表時,第二個數字代表分。

輸出說明:請輸出時針與分針間較小的那個夾角。

輸入範例:

12 31

輸出範例

170.5
[Exercise] Coding (C) - asked in 2016-1 程式設計(一)AD by (18k points)
ID: 18068 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00

reshown by | 5.3k views

67 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>
*** * * * ***** *

int main()

{
** * * * **** ******* m,h;
* *** ** * * ** ** *** * ** ** ** * ** * *** *****
* ** ****** ** * ** **** *
* ** ** * * *** *** * * * * *
**** * * * **** ** **** *****
** *** **** ***** ** *** ***** * * *
* *** * *** **** * ** m=h-m;
* ******* ****** * * * ***** * ** **** * ** **
** * *** ** * * * *

}
answered by (-38 points)
0 like 0 dislike
Hidden content!
#include * **** *

#include * ** ** * **



int main()

{
*** * * * * * *** * *** clock24, min, clock12, clockp, minp, ang;
** * **** * * *** ** *** **** **** **** **
** ** * * ***** * * *** ** ** * * * ***
* ** ** ****** ** * * (clock24 >= 12)
* *** *** ** *** * ** *** *** ****** *** = clock24 - 12;
** ** * *** ***** = * * ** * 30) + (min * 0.5));
** * * * ***** *** * * * = (min * 6);


** * * ** ** ***** * ** = clockp - minp;
* ** ** ** * * * *** (ang < 0)
******* *** * * *** ***
* * * ** **** * ** * *** ** *** *** * ** *** = -ang;
**** ** * ** *** * *
*** * **** * * *** *** * (ang > 180)
* * * ** ** *** ** ** *
* * * ** * *** *** *** *** * * * = 360 - ang;
* * ** * ***** *


** * ** ** ** *** ** * ** **** ang);


* * ** * * * ******** 0;

}
answered by (-214 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

int main()

{
**** * * *** * * * ** ***** hr = 0;
* * * ********* *** * *** min = 0;
** ** * ****** * * ** * * ** %d", &hr, &min);
*** * ** ** ** * * angle = 0;
** ** *** * * * ** * * >= 12)
* *** ** * * * *
** ** * *** * * **** * * ** *** *** * * = hr - 12;
** *** * * * ** ** * * **
** * * * * * * ** m_an = 0;
** * * * * *** * * * * * * * h_an = 0;
*** * *** *** ***** * * = min * 6;
* ** ** ** *** * **** ** * = hr * 30 + min * 0.5;
* *** *** * ** * * > h_an)
*** *** * * * *
* * * ** * ** ** ***** * * ** ***** ** = m_an - h_an;
** * * ** * **** * * *
****** *** * * * ** * * ****
** * * * *** *
** ** * *** * * * ** ** ** ** ***** * * *** * * = h_an - m_an;
** * * * * * **
* ** * * * ** * ** * * *** > 180)
* * * * * * **** *
** * ** * * ** * * *** ** * ***** * *** * = 360 - angle;

* * *** ** ****** *
**** *** **** * ** ** * * *** **** angle);
* **** * * * * ***** * * *** * **** *
* ** ** * * * * ** ** *** * 0;

}
answered by (-202 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
* *** ** ** * * * *** a,b,c1,c2;
*** ** ** * * ** * * * x,y;   
* * ******* *** * ** * ** **** * * ** *
** * *** * * * *
* **** ** ** **** ** ** * * **
* * ** *** * *** *** **** *
** * ** ** * * * ** *** *
* ******** **** * * *****  
* **** ** **** *********** * ***** * ** * *** ** **
*** * *** ***** *** *** * * ** *** *
* * ** ** ** ******* ** 0;

}
answered by (-284 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

int main()

{
* **** ** * * * * hr = 0;
**** * * **** * * ** ** ** min = 0;
* ******** * **** * ** *** ** * %d", &hr, &min);
** * * ** * *** * ** ** angle = 0;
* ** * * ** * * * *** >= 12)
** * * * *** *
* ***** ****** ** **** ** * ** = hr - 12;
* ** * ** *** *
* **** * ** **** * m_an = 0;
* * ** * **** *** * h_an = 0;
** ** * ** * ** * * ** ** * ** = min * 6;
* **** ** * *** * = hr * 30 + min * 0.5;
* ***** * **** ** *** *** ** * ** ** > h_an)
* ** * * **** ** * * * *
** ** ** * ** * *** ****** * * ** *** ** ** ** * = m_an - h_an;
* **** ** * *** * ****
* * ** * *** * *** *** ****
** * * * * * ** ** *
** ** **** * * ** * ** * * ************* * * * = m_an - h_an;
** *** * * ** ** ** * *
** * ** ** * *** *** > 180)
** * * * * * ** * *******
* *** * ******* * ** * * **** * ** * *** = 360 - angle;

*** * * **** *** * * ** *
** * * *** ******* **** * ** **** ***** angle);
** * * * * *** *** * * *
*** ** ** *** * ** *** 0;

}
answered by (-202 points)
0 like 0 dislike
Hidden content!
#include * ** * * ***** *

#include * *** * ***

#include * * * * *



int main(int argc, char *argv[]){
*** *** * * * ****** * * * *** * *
* *** * * * * *
* ***** * * *** * ** * * * * * * * * * ** *
* * * * *** * * ** **** = b*6;
***** * ** ** * * = a*30;
* *** * **** ** **** ** ** += 30*sb/360;
* ******** * *** * *** * * > 360)
* ** * ** *** **** * ** * **** * * *** * ** = sa-360;
* * *** ******** * * * = ** * ***
* * *** ***** ** ** > 180)
** ** * * ** ** * ** *** * * * = s-180;
* * ****** **** ** ****
* * * ** *** ***** ** *** * **** ***** ** * *

  

  
**** ***** * * * ** * * * *** *  
* ** * ***** ***** 0;

}
answered by (-216 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
******* ** ** ** small , big , angle ;
***** * ** * * * * **** hr , min ;
* ***** * * * ** * ***** * * %d",&hr,&min);
* * * * *** * * ** ** ** * * * ** *
* * * * * ***** * ** ****** ** * ** * * = hr % 12;
* *** ** ** ** **** * = hr*30 + min*0.5;
* * * ** ** * * * * = min*6 ;
*** ** * * **
** * * **** ******* * ** **** * *
* ** *** ** * ********** * * *** * * ***** *** ** ** = big - small ;
** * * *** * ** **** *
** **** * ** **** *** * *** * **** ** **** = small - big ;


** * **** * ** * * * * ** *
* * * ** ** * * **** * ** **** **** * ** * ** ** * * * ** * * * *
* ** **** * *** *** **
* *** ** ** ***** * ** * * *** ****** * * ** * *** ** * * *** ****
*** * * ** * ***
* ***** * ** ** **** * * * **** * **** ******** * *
* ** ** * *** * ** *** * * 0;

}
answered by (-162 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
* * *** ** ** ** * small , big , angle ;
* ** *** ** ** *** ** ** *** hr , min ;
** **** * ******** ** * ** %d",&hr,&min);
** * * * ** ***** ** * ********
***** ** * * * ***** ** * ****** **** **** * * = hr % 12;
* * ** ** * * ** * ** * * = hr*30 + min*0.5;
* ** ****** **** * * = min*6 ;
* * * * * * **
** *** * * * * * **** * **
* * **** ** ** ** **** ** *** ***** * ** * = big - small ;
** * **** **** ***
** *** * * * * ** ** *** * ** ** * = small - big ;


* * *** * ***** * **** * * * * ***
* *** * * ***** * * * * * ** ** ** * ** * ***** ** ** ** ** ** ****
** **** ** ** * * ***
** * *** **** * * * *** * ** ** ** * * * * * * **** * * * ** **** * ******
**** * * ***** **** * * ** **
* ** * ** ** *** * * ** ** *
* * * * ** ** *** * 0;

}
answered by (-162 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



int main()

{
* * * * * * * * ** * ****** i, j, a;
*** * *** * * * b,c,d,e,f,q,w;
*** ** ** *** ** ** ** **** *** ** * ** * *
* * **** * ******* * ** * * * ** ** *** *
***** * * ** * * ** * = j*6;
*** *** *** * * * * = i*30+j*0.5;
* * * * ** * *** * * * = b-a;
* * * * * **** * * ** * * = b+360-a;

    e = a-b;

    f = a-b+360;
* * * ******* * **** ** * * < 0)
* *** ****** * *** * ******
* * * ** * *** ** ** < 0)
** ** * ** * ***** * **   
** ** ** *** * * * * ** < 0)
****** ** ** ** * ** *
*** * ** ** *** ** < 0)
** **** * ***
* * * *** * * * * < d)
* * * * * * * *** * ** * ** * * = c;
*** ** * * * ***
**** ** * ****** ** * ** * * ******* * = d;
** * * * * ** ** * ** < f)
** ** * * ***** *** ** * * ****** * ** = e;
* * *** * * * ** ** ** * *
* * * ** *** * ** *** *** * * ** **** **** = f;
* ****** * * ** *** * < f)
** *** * *** *** * * * * *** *** * * ** * ** ** * * *
* *** ** ***
*** ** ** * * * ** * **** ** *** * * * * *** * * * * ** *
* ** * *** * ** ** **** ** * ******* **
* * **** ** *** *** * 0;

}
answered by (-202 points)
0 like 0 dislike
Hidden content!
#include * ** * **** **

#include ***** * **

#include ** * *



int main(int argc, char *argv[]){
** * * * *** *** **  a,b,sa,sb,s;
** * ** * * ***** * ****** *
**** * * * * * * * * ***** **** * **** *
* ** ** ** * **** ** = b*6;
***** * * * * = a*30;
* ** *** *** * * ***** * * ** * * * **** ** *
* ** ** ** ** * ** *** = *** *** * ****
**** **** * ** * * * * *** * ** * ******
* *** ** * * * ****** * > 180)
*** ****** * * * ** * *** *** * * ** * ** * *** = s%180;
* *** * * ** * * * *
* *** * * * **** * *** *** *

  

  
* * *** * * ** * ** **** **  
* ** * ** ** * * 0;

}
answered by (-216 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.115
©2016-2025

Related questions

0 like 0 dislike
5 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18074 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 1.1k views
0 like 0 dislike
96 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18072 - Available when: Unlimited - Due to: Unlimited
| 6.8k views
0 like 0 dislike
13 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18069 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 1.6k views
0 like 0 dislike
11 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18065 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 1.6k views
0 like 0 dislike
0 answers
[Resource] asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18084 - Available when: Unlimited - Due to: Unlimited
| 7 views
12,783 questions
183,442 answers
172,219 comments
4,824 users