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 | 9 No |
Is c functional or procedural?
Can two or more operators such as and be combined in a single line of program code?
Explain what is the concatenation operator?
what are the static variables
8 Answers HCL, iFlex, TCS, Wipro,
Is it valid to address one element beyond the end of an array?
There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side?
The differences between Windows XP and Windows Visa
What is pointer and structure in c?
what is the difference between structural,object based,object orientd programming languages?
Here is alphabets : abcdefgh 1) how to reverse. as hgfedcba 2) after reversal, how to group them in a pair hg fe dc ba.
what is the associativity of bitwise OR operator?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant