Write a program to insert number of days from user and calculate number of weeks and remaining days

Number of days is taken from user and number of weeks and remaining days are given as output.

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. int n,d,w;
  7. cout<<"enter Number of days u have:. ";
  8. cin>>n;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. w=n/7;
  12. d=n%7;
  13. cout<<"No.of weeks= "<<w;
  14. cout<<"\nno. of days= "<<d;
  15. getch();
  16. }

Check out this stream