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
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 |
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 |
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 |
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 |
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 |
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 |
A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE
Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance
Explain polymorphism. Provide an example.
Do not use more than 3 nested IF. Use Evaluate statement in case of more IF required. Please give a detail explantion besides readability and clarity for Evaluate stmt.
Difference of Console, web & windows applications?
How to convert numeric value into words in c#????plz suggest me the coding of this question???
what is dynamic polymorphism?
difference between mantis and other tools?
My Qualification is MCA.My interview is on 5th may.They may ask q as------AS u r MCA...Why u r not tring anywhere else? What can be the ans?
0 Answers State Bank Of India SBI,
What are the compilers of JAVA and .NET Programming languages?
what are the differences between CONS, LIST, and APPEND
how to run servlets in eclipse 3.3.2....if we choose file->new->servlet then after that it is showing javax.servlet.* ...cannot be resolved.......to avoid this error any external jar file is to be added? please help me regarding this issue........thank u