Write a program to add a given duration with time(24hrs format)
Answer Posted / 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 |
Post New Answer View All Answers
How do you determine the length of a string value that was stored in a variable?
What is #line in c?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Explain what are global variables and explain how do you declare them?
Linked lists -- can you tell me how to check whether a linked list is circular?
How are portions of a program disabled in demo versions?
Explain the bubble sort algorithm.
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What is void main () in c?
What is call by reference in functions?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
Can we declare variables anywhere in c?
C language questions for civil engineering
Whats s or c mean?
difference between Low, Middle, High Level languages in c ?