Write a Pseudo Code to find the angle between two hands of a
clock for a given time.

Answers were Sorted based on User's Feedback



Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / batchu

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int hour,minute;
float angle;
printf("Enter the hour: ");
scanf("%d", &hour);
printf("Enter the minute: ");
scanf("%d", &minute);
if(hour>12)
{
hour = hour-12;
}
angle = hour * 30 + minute*0.5 - minute * 6;
if(angle>180)
{
angle = 360 - angle;
}
if (angle < 0 )
{
angle = angle * (-1);
}
printf("%f \n", angle);
return 0;
}

Is This Answer Correct ?    7 Yes 2 No

Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / spacious mamun

#include<stdio.h>
int main()
{

int angle,hour,minute;
printf("Enter the hour: ");
scanf("%d", &hour);
printf("Enter the minute: ");
scanf("%d", &minute);
if(hour < 12) // In case of 24 hour clock
hour=hour+12;//to make the hour in 24 hour format;
{
(int)angle = hour * 30 - minute * 6;

if(angle > 180)
angle = 360 - angle;
printf("The angle between the two handle is: ");
printf("%d\n", angle);
}

return 0;
}

Is This Answer Correct ?    12 Yes 11 No

Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / samer el-haj-mahmoud

#include<stdio.h>
int main()
{

int angle,hour,minute;
printf("Enter the hour: ");
scanf("%d", &hour);
printf("Enter the minute: ");
scanf("%d", &minute);

if(hour > 12) // In case of 24 hour clock
{
(int)angle = hour * 30 + minute / 2 - minute * 6;

if(angle > 180)
angle = 360 - angle;
printf("%d\n", angle);
}
else
printf("bye\n");

return 0;
}

Is This Answer Correct ?    6 Yes 6 No

Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / thsghdth

le angle;
printf("Enter hour and minute in 24 hr format\n");
scanf("%d %d",&hr,&min);
angle=30*hr+(double)min/2-min*6;
if(angle<0) angle*=-1;
while(angle>180) angle-=180;

printf("%.2

Is This Answer Correct ?    2 Yes 3 No

Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / fanatic

#include<stdio.h>

main()
{

int hr,min;
double angle;
printf("Enter hour and minute in 24 hr format\n");
scanf("%d %d",&hr,&min);
angle=30*hr+(double)min/2-min*6;
if(angle<0) angle*=-1;
while(angle>180) angle-=180;

printf("%.2f\n",angle);
return 0;
}

Is This Answer Correct ?    3 Yes 6 No

Write a Pseudo Code to find the angle between two hands of a clock for a given time...

Answer / mamun

#include<stdio.h>
int main()
{

int angle,hour,minute;
printf("Enter the hour: ");
scanf("%d", &hour);
printf("Enter the minute: ");
scanf("%d", &minute);

if(hour > 12) // In case of 24 hour clock
{
(int)angle = hour * 30 - minute * 6;

if(angle > 180)
angle = 360 - angle;
printf("%d\n", angle);
}
else
printf("bye\n");

return 0;
}

Is This Answer Correct ?    2 Yes 16 No

Post New Answer

More Programming Languages AllOther Interview Questions

What is meaning of web application. & the purpose of web application. with description.

1 Answers  


how can we get version of database ?

1 Answers  


Write a program to calculate the following i want a Java program for this condition 1+4+9+16+….+100 Like this (1^2+2^2) Hint use function pow(a,b)

4 Answers   HTC,


hi friends please tel me how to handle the recovery manager(All i.e PopUp ,Application Crach ,Object state,etc) in QTP

1 Answers   IBM,


Differevce between arrays and array builders?

0 Answers  


What is a singleton linked list?

1 Answers   Wipro,


1.how to deploy the Maven application in weblogic server? 2.In Real time projects all classes are singleton or some classes only singleton explain? 3.what are the major uses of the designpatterns? 4.explain restful &Soap based services explain?

0 Answers   Accenture,


How can we alter the data after creating a view

1 Answers  


Give examples of macro quoting function?

0 Answers   GE,


Info for guidewire documents and interview questions

1 Answers  


what is the difference between a looping statement and a decision statement

4 Answers  


What is algorithm in SCD Type2(SAS DI Studio Transformaton)?

2 Answers  


Categories