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 |
Why we need new operator in java at the time of object declaration and why not in c++?
how many types of operating system are avaliable?
What is abstract Method i want the exact definition and is there any possibility to declare class as abstract without any abstract methods in that class?If it is possible then tell me why and how?
Hi friends :) This Company Aptitude Questions were much easy. i have attended the interview but was not selected in the HR round. they used to ask questions like puzzles, English, fill up the sentence. for example : they asked one question like suraj, kumar, santhosh, ranga and ashwin are professionals in different fields. suraj is a doctor. kumar is not a musician.ranga is working as engineer. ashwin is from goa. santhosh is from chennai. suraj and ranga are not from delhi. find out who is working in which field and where are they from? it was not the exact question. i answered that question with correct answer. just thorough with SQL queries. they are much interested in that. i cleared Technical round where they asked me to write a C code for checking, if the given word is palindrome or not. also they asked 2 puzzle question to solve in front of them. then the asked SQL query for referring two tables. then, they sent me for HR round. i got little nervous in that round. so, could not answer them properly. In Hr round, they may ask Technical Questions. i was asked only Technical Questions in HR round. they asked questions from SQL queries and my project. i could not answer for the questions perfectly. so, i was not selected. anyway, try to be thorough with these info and rock in your interview. Thanks :)
what is log files in qtp what is use
What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?
details description on this mantis? who is founder of this mantis?
how to convert the data from HTML file to SAS dataset?
Why data bus is bidirectional and address bus is unidirectional?
I need to fetch all rows from the table based one field value in the table and later do a condition check if the condition is true I will have to move all the rows present in the data base to output file one else if the condition is not satisfied then move all the records of that field value into another file .Please let me know how to do that
Code for display the images from drive using vb 6.0?
why we use static with only main()class not with other class