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 for decision coverage and modified condition decision coverage are used? Wat is the difference between them?

0 Answers  


what do u mean by html

5 Answers   Infosys,


How can recruiter justified that the candidate is expert in Algorithm and datastructure for Software product development ?

0 Answers  


what is the difference between uservariables and systemvariables (in Environmental variables)???

0 Answers  


What is good attributes of Programming language ?

6 Answers   GKN Land Systems,






what is the difference between SCAN AND CHECK,LOKUP AND XFOOT? where we can use thease opcodes? Can any body tell me real time senariao with example?

0 Answers  


What are the advantages of Server Controls over HTML/ASP Controls.

1 Answers   Tesco,


hi This is radhika.Can anyone help me to know the question papers of NATIONAL INFORMATICS CENTRE for the post of scientific officer/engineer? if anyone know plz tell me question paper pattern

0 Answers  


Given: (x-2)(x+3)= 100; solve the equation for x using any programing language.

2 Answers   Amazon, Manhattan,


4.Write a program to get the string in array and print that? or Without using loop print the array.

3 Answers  


What is the use of Differ interface check box in Ship confirm?

0 Answers  


differenc between visual studio 2005,2008 & 2010?

2 Answers  


Categories