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 (2265)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
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
 
how many trailing zeroes are there in 100! (100 factorial)?   3
how can i apply validation without using errorprovider in C# windows application   1
what you mean by mantis in IT interview? why we use mantis? advantage of mantis?   1
For C sharp,At the time of software is implemented at client site, is it required that client machine have C sharp(Microsoft Visual Basic) setup? Honeywell 1
Piggy backing is a technique for a) Flow control b) sequence c) Acknowledgement d) retransmition HCL 17
6.int x=10; float y=20; a=x%2=? b=y%2=?   1
what is software   2
how many languages .net is supporting now?   4
why main() method should not return any value Accenture 2
A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE Nagarro 7
9. Read the function conv() given below conv(int t) { int u; u=5/9 * (t-32); return(u); } What is returned (a) 15 (b) 0 (c) 16.1 (d) 29 TCS 2
what is the difference between primary key and unique key? TCS 2
 
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