ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> Programming Languages AllOther
 
 


 

 
 C interview questions  C Interview Questions (2266)
 C++ interview questions  C++ Interview Questions (1121)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (652)
Question
Write a Pseudo Code to find the angle between two hands of a
clock for a given time.
 Question Submitted By :: Programming-Languages-AllOther
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
#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 ?    6 Yes 1 No
Batchu
 
Answer
# 2
#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
Spacious Mamun
 
 
 
Answer
# 3
#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
Samer El-haj-mahmoud
 
Answer
# 4
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
Thsghdth
 
Answer
# 5
#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
Fanatic
 
Answer
# 6
#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
Mamun
 

 
 
 
Other Programming Languages AllOther Interview Questions
 
  Question Asked @ Answers
 
design a counter with the following repeated binary sequence: 0, 1, 2, 3, 4, 5, 6, 7, 8 using JK Flip Flop. Nortech 3
whats the Need for Concurrency control   1
what is the difference between an application and service??? i mean service which runs as in services.msc.   2
Hi, I'm doing B.com 3rd year. Simultaneously I'm doing software engineering in a private institution. I would like to know whether my B.com graduation alone is enough to get me a job in the IT field or should I do some PG course not MBA... suggest me...   1
in a company 30% are supervisors and 40% employees are male if 60% of supervisors are male. what is the probability that a randomly choosen employee is a male or female?need steps to solve this? TCS 1
What is the worst case of AVL tree?   1
what is software   2
A combination of multiple keys defined in a physical file or logical file is called a _________ key IBM 3
What is meant by SQL,PL/SQL,SQL PLUS? Is there any differnece between them? HSBC 2
Full from of MP3?   2
what is the maximam caption size of lebel   1
Write a program to implement BFS/ DFS routine in a connected graph   1
 
For more Programming Languages AllOther Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com