You are on page 1of 2

#include<iostream>

#include<conio.h>

void main ()

int start_day,n_days;

cout << "Enter the first day of a month eg 1 for Sunday, 2 for Monday, etc. ";

cout<<endl;

cin >> start_day;

cout<<"Enter the number of days in a month btn 28-31"<<endl;

cin>>n_days;

if((start_day>=1&&start_day<=7)&&(n_days>=28&&n_days<=31))

cout << endl << "Sun\tMon\tTue\tWed\tThr\tFri\tSat"<<endl;

for (int i = 1; i < start_day; i++)

cout << " \t";

for (int j = 1; j <= n_days; j++)

if (((j + start_day - 2) % 7 == 0) && (j != 1))

cout << endl;

cout << j<< "\t";

cout << endl << endl;

else

cout<<"Enter the valid numbers for startday or days";


getch();

You might also like