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

write algo for cobol program whichuse three flat file to extract some specific information 8 marks mainframe

0 Answers  


what are all the validation we need to perform in data stage?

0 Answers  


Hi can you please help for the following. I have a ASP.Net web page I want to print the whole page how is it possible? I want It in ASP also.Please send me the solutions dipankar.hazari@gmail.com . Thanks in advance.

0 Answers   Philips,


what does mean and stack mean in genral programming?

0 Answers  


What is the requirement in MIMD ?

1 Answers   Honeywell,






if we want to move all the items that are already added in a combobox into an empty list box or vice-versa then how can it possible in vb or C# ?

1 Answers  


What r the attributes using in Win Runner?

0 Answers   Tavant Technologies,


What is the difference b/w Object base and object oriented programming?

1 Answers  


what are importance in problem tracking

0 Answers  


Info for guidewire documents and interview questions

1 Answers  


what is c sharp dotnet

0 Answers   NIC,


what is the difference between "types" and "data" in abap.

4 Answers   Tech Soft,


Categories