Write a program to add a given duration with time(24hrs format)



Write a program to add a given duration with time(24hrs format) ..

Answer / heena r yeole

#include<stdio.h>
int main (void){

int dept1,dept2,dept3,dept4,dept5,dept6,dept7,dept8,hh,mm,entertime;

printf("Enter a time in 24-hour format:");
scanf("%d:%d",&hh,&mm);


dept1=8*60;
dept2=9*60+43;
dept3=11*60+19;
dept4=12*60+47;
dept5=14*60;
dept6=15*60+45;
dept7=19*60;
dept8=21*60+45;

entertime=hh*60+mm;

if(entertime<=dept1){
printf("Closet Departure time is 8:00 A.M,arriving at 10:16 A.M");
}else if(entertime<=dept2){
printf("Closet Departure time is 9:43 A.M,arriving at 11:52 A.M");
}else if(entertime<=dept3){
printf("Closet Departure time is 11:19 A.M,arriving at 1:31 P.M");
}else if(entertime<=dept4){
printf("Closet Departure time is 12:47 P.M,arriving at 3:00 P.M");
}else if(entertime<=dept5){
printf("Closet Departure time is 02:00 P.M,arriving at 4:08 P.M");
}else if(entertime<=dept6){
printf("Closet Departure time is 03:45 P.M,arriving at 5:55 P.M");
}else if(entertime<=dept7){
printf("Closet Departure time is 07:00 P.M,arriving at 9:20 P.M");
}else if(entertime<=dept8){
printf("Closet Departure time is 09:45 P.M,arriving at 11:58 P.M");
}

Is This Answer Correct ?    2 Yes 8 No

Post New Answer

More C Interview Questions

How do you write a program which produces its own source code as its output?

4 Answers  


actually i have 2 years teaching experience as computer faculty but now i am a DBA but when i go for interview many peoples asked me why i left my teaching profession and why i want to come in this field kindly give me the proper answer of this queston

3 Answers   Ramco,


Explain how do I determine whether a character is numeric, alphabetic, and so on?

0 Answers  


what are the stoge class in C and tel the scope and life time of it?

2 Answers   Tech Mahindra,


How do you define a function?

0 Answers  






shorting algorithmS

0 Answers   Wipro,


An entire structure variable can be assigned to another structure variable if __________

3 Answers   Sasken, TCS, Tech Mahindra, Wipro,


9.how do you write a function that takes a variable number of arguments? What is the prototype of printf () function? 10.How do you access command-line arguments? 11.what does ‘#include<stdio.h>’ mean? 12.what is the difference between #include<> and #include”…”? 13.what are # pragma staments? 14.what is the most appropriate way to write a multi-statement macro?

4 Answers   L&T,


how to implement stack operation using singly linked list

2 Answers  


is forign key will be unique key any table or not?

2 Answers  


write a program in C to swap two variables

7 Answers   Attrabyte, Marlabs,


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

0 Answers  


Categories