W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

Snehil Khanor's Binary Log

Write a program to display seconds as Minutes and Hours and days


write a program that asks the user to enter a number of seconds. obeying the following conditions:
1. there are 60 seconds in a minute. if the number of seconds entered by the is greater than or equal to 60, the program should display the number of minutes in that many seconds.
2. there are 3600 seconds in an hour. if the number of seconds entered by a user is greater than or equal to 3600, the program should display the number of hours in that many seconds.
3. there are 86400 seconds in a day, if the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds,
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float secs,mins,hours,days;
  7. cout<<"Enter no. of seconds: ";
  8. cin>>secs;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. mins=secs/60;
  12. hours=secs/3600;
  13. days=secs/86400;
  14. if (secs>=60 && secs<3600)
  15. cout<<"No. of Minutes= "<<mins;
  16. else if (secs>=3600 && secs<86400)
  17. cout<<"No. of Hours= "<<hours;
  18. else if (secs>=86400)
  19. cout<<"No. of Days= "<<days;
  20. else
  21. cout<<"No.of seconds= "<<secs;
  22. getch();
  23. }

0 comments:

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log

Blog Archive



eXTReMe Tracker