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 |
What for decision coverage and modified condition decision coverage are used? Wat is the difference between them?
what do u mean by html
How can recruiter justified that the candidate is expert in Algorithm and datastructure for Software product development ?
what is the difference between uservariables and systemvariables (in Environmental variables)???
What is good attributes of Programming language ?
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?
What are the advantages of Server Controls over HTML/ASP Controls.
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
Given: (x-2)(x+3)= 100; solve the equation for x using any programing language.
4.Write a program to get the string in array and print that? or Without using loop print the array.
What is the use of Differ interface check box in Ship confirm?
differenc between visual studio 2005,2008 & 2010?