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

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

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

輸入範例:

12 31

輸出範例

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

reshown by | 6.8k views

62 Answers

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

# include <stdlib.h>

int main()

{

    double a,b,c,d,e,k;

    scanf("%lf",&a);

    scanf("%lf",&b);

    if(a == 12)

        {
* ** *** **** ** ** * * * * * ****** ** * * *** ** ** * * * **** * ** = (b/60)*30;
* * * *** ****** * ** * * ** ** * ** ** * ******* ** * *** * = b*6;
*** ** *** * ** * * * * * * * ** ** * * * *** ** * * ** = abs(d-c);
* *** ** * * ** * ***** ** ** ** ** * *** ** * * **** * * * * * *
***** * ** * ** *** * **** *** * ********* **** **** ****** * ** *** e<k)
*** *** * **** * *** ***** **** ** * * * *** ** * * ** *** * * *** *
* ** ** * * *** ****** ** * * * *** * *** * ** ** ** ** ** *** *** *** ** ***** ****** * ** * * ** *** * **** * ** *
* * * * ****** * * * * * * * * ** *** * * * * * * ***** *** * * * * * ***
* **** ** ******** ** ** * ** * *** * * * * *** *** * * ** * * ** * * *
** * ** * * * * * ** ** ** * *** ** * * * * * * * *** * *** *** * ** ******* ** *** **
* * * **** * * ** * ** *** * ***** ** **** * *** *** ** * *** ** *** ** * *** * * **** *** *** * *** * ****
** * * * * * * ***** * * ** * * **** * * ** ***** ** ** ***** * * * *** ** * ** *

        }

    else

        {
* * * *** ** * * * **** ******* *** * * * * ** * * ** * ** = (b/60)*30+(30*a);
* **** ** * ***** * ***** * * * * *** ** ** ** ** *** * * *** * * * = b*6;
* *** *** * *** * ** ** *** ** * * * ** *** * ** **** * * **** * * ** * * = abs(d-c);
* ** ** *********** ** * ** ** * * * * ** ******* * * ** * * * ** * ** ** ** *** *
**** ** * ** ** * * * * * ** ** *** ** * ** *** * * * ** * *** * ** * * ** *** * e<k)
* *** * * * * * * ** ** ** *** ***** * ** *** * ** * * **** *** * ** ***** ** *** * *****
* * * * * * ** * ** **** * ****** * **** ** ** * * ** ** * *** ** * * ** * *** ** *** ** * ** * * ** * * * ** ** * * ***
* * * * * * * * **** * *** ***** * ** * * ** * ***** * **** ** * ********** * * * ***** **
** *** *** ****** ** * ***** ** * ****** * *** ** ** **** * *** **
* * ** * * * ** * *** * ** *** ** * * *** * **** *** * * * ** *
* * * ** ** * * * * ***** * ** * * * ** ***** ** * * ** * * ** ** **** *** **** ** * ** **** ***** ** * * ** * ******
* ** * ***** *** *** * ** ** * * **** * ** * * * * **** ** **** * *** ****

        }



    return 0;

}
answered by (-158 points)
0 like 0 dislike
Hidden content!
* * *** ****** * **
**** * * * ** ***
* ** **** * *** ** *

#include <math.h>



int main(void)

{
* ** *** * *** * *** * h, m, i, j;
** ** *** * * * ** *** * *** ma, ha, fin, a;
* * * * *** ** ** * ** * * &h, &m);


**** * * ** **** * **** (h<=0 || h>12)
** * * * * ** * **** * * 0;
* ****** * * * * ** * **** || m>60)
*** ** * * ** * * **** * 0;


** * **** ** * ** * != 12)
** ** * *** *** ** ** *
* * * * *** * ** * ** * * * ** **** * * ** i<= h-1; i++)
* **** ****** ** **** ****** * * ***** ***** = 30*i;
* * * * * *** * * ** *


**** * ** * * *** * ** ** j<=m; j++)
** * * * * * * * = 6*m;
*** * * * * ** * ** = ha+0.5*m;


* ***** ** * * * *** = ma - ha;


** ****** ****** ** **** * * *
* ** ** ** **** * * ** ***** ** *** ***** = 360-a;
* **** **** * * ****
** *** * * * * * ** ** ** * * * * ***** = a;


* * * ***** * ** ***** ***** ** * < 0)
** **** **** * ** * * * * * **** * ***** ** * -fin;


*** ** ** * ** *** ** **** * * **** * * fin);


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

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



int main(void)

{
*** * * * ******* h, m, i, j;
* ** * * ** **** ** ***** **** ma, ha, fin, a;
** * * * ***** *** *** * * * ** &h, &m);


* * * * * * * ** *** (h<=0 || h>12)
* ** * * ** ** * * ** 0;
** * * * *** *** * **** || m>60)
* * * * *** * ** ** * 0;


**** *** ** ** *** * != 12)
* * * * * * *******
*** *** * * * * * ** * ** * * *** ** * * ** *** ** * * ** i<= h-1; i++)
******* ** * *** ** * ** * ** * ** ** * * = 30*i;
* ** **** ****** * * *


**** *** * * * ** ** *** * j<=m; j++)
* * **** * *** *** = 6*m;
* * *** ** ******* = ha+0.5*m;


** *** ** *** = ma - ha;


***** *** ** * * ** * * *
*** * **** ** * **** ** * * ** * * * * ** *** = 360-a;
** ** *** *** ** * *
* ***** * * ** * * * * **** *** ** ** * ** * = a;


***** * * *** * * ** ** * * *** fin);


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

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



int main(void)

{
* ** ***** ********* * h, m, i, j;
***** ***** * ** * * ma, ha, fin, a;
* * * ** ** ** * * * ***** ** ** &h, &m);


* ** * *** *** ** ***** (h<=0 || h>12)
* * * * **** ***** 0;
*** ** * *** ** ** * ** || m>60)
** * ** * ** ** **** 0;


*** * **** ** * *** * i<= h-1; i++)
** * ** * * * * ***** = 30*i;


* ** ** * *** ***** j<=m; j++)
***** *** **** ** * *** ***** = 6*m;
* **** *** *** * ***** = ha+0.5*m;


* ** * * * * * ** *** **** **** *** * *** *** ha);
** **** ** ** ****** * * ** ma);


** * ** ***** ** ******** * = ha - ma;


******** *** ** *** ** ** ** **
* *** ** ** ** * * * * ** * * ** * ** * = 360-a;
* ** ******* *** *** * ** * * *
** ** * ** ** * ** ** ** ** ******* * ** * = a;


* ** * * ** *** * *** *** ** * * * fin);


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

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

#include *** ** *** ***

#include <math.h>



int main()

{
** * * * ** ** *** * *** * i,j,h,m,r,a;
* ********* * ** * ** * ** ** ******
* * *** * ** **** ***


** ***** * * * * *** * *
*** * ****** * * *** * * ** ****** ****

if(m-h>180)


** * ** ** ** ** ***** * * ***




*** * * * *** * ** **
** * * * ***** ** * *** * * *** ** *** * * **


* *** ** * * *** * ** **** * ***
* * * ** * ** **** **** * * * * * *** *** *** **** * ** ** * *

return 0;

}
answered by (-248 points)
0 like 0 dislike
Hidden content!
* * * ** * * * * **
* *** **** *
* ** * * ** *





 float main()



{



 float h=0, m=0, i=0;


* ** * * * * ** * ,&h);
**** *** * * * * *** *
* ** * *** ** ,&m);
* *** * **
* * * *** **** * ***** * * *
** * ** ***** ****** * *** ** 5.5*m-30*h;
* * *** ** * * * * *** **
** * ** ** * * ** * * * ** 30*h-5.5*m;

 else
** **** * *** ** ** * *
* ** * *** * ** ** ** ** ** * * ** ***
** ****** **** * *** * *
* **** * *** * *** * * * ** * *** ** * **


***** **** * *****
**** ** **** * * * * **** * ***** * ** ,i);

 else if(i<0)
* * **** ** *** ** ** ** * ,i);

 else
* *** ***** ** ** * ** * ** ** *** * ** ,360-i);


* * ** *** 0;

}
answered by (-34 points)
0 like 0 dislike
Hidden content!
*** ** ** * * *


* * ** * ** *


*** * **** *


*** * ***** * * *




* * ( * )

** **
* ** **


** *** * * ***** ** *** *
** *** *** **** ** * *
* (a = {a = * *

d = *

e = ***** **
** % 2 !=
** = d - *
*** **** ** = * - **** *** ** * *** * * * *** *
* *

***** * ** = d - * ***** ***** * * *** * * * *
**










** * * **

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

#include * ** * * ** * * **

#include ** ***** ** *



int main()

{
* * * ** ** * * *** * **** i,j,h,m,r,a;
********* ** * * * * ** ***** * *
***** * *** **** ** * *


***** * ***** * ** *
** *** * * *** *** **

if(m-h>180)


** ***** * * * * * * *




* **** ***** *
* **** *** **** * *** ** ** * ***

return 0;

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

#include<stdlib.h>

#include<math.h>

int main(void)

{
* *** * *** ** ** ** *** a=0,d=0,b=0;
* * ** *** ** ** ** * e=0,g=0;
***** * *** ** * * ** * * ***** * *** * * * ** * ** *
** *** ** * ** ** *
* ** * ** *** ** * * * **
* * * ********** * * * ** if (a==1)
* * * * ** * * *
* * * * * *** ** ** ***** ** if (a==2)
* * * ** ** **** ****
** * ****** ** *** ** if (a==3)
** ** *** **** * ***
* * ** ** ** *** * *** if (a==4)
* * * **** * * * * * **
**** ** * * ** ** ** * if (a==5)
* * * **** ** ** * *
* *** * * ** * * * * * ** if (a==6)
* * * ** ** **
*** * ******* * ** ** * * if (a==7)
* * * * * * * *** ** *
** ** ** * **** * * **** * if (a==8)
*** * * * ** ** * * **
* ** ** *** * ** * * ** if (a==9)
* ** ** ***** * * *
* *** * * ** * *** * * *** * * * if (a==10)
** * *** * ** * * ** * * ** *
* * * * * * * if (a==11)
** * **** ** * *
* ** * * ** * *** * *

** **** * * * ** ** ***

    
* *** * * * * * ** ****** *

    
* *** *** * * **** *** * ** *
* * ** ** * * *** ** *** * **** * ** * * *
********** *** * *** * if(b<=59)
* * **** * ** * *
** **** * **** * ** *    
**** ** * * *** * * *** * *** ** * * *** *
* * ** *** * ** *
* ** ** * * * *** 0;

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

Related questions

0 like 0 dislike
16 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18075 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 2.6k views
0 like 0 dislike
86 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18071 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 8.5k views
0 like 0 dislike
49 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18070 - Available when: Unlimited - Due to: Unlimited
| 4.9k views
0 like 0 dislike
21 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18066 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 3k views
0 like 0 dislike
0 answers
[Resource] asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18085 - Available when: Unlimited - Due to: Unlimited
| 10 views
12,783 questions
183,442 answers
172,219 comments
4,824 users