Skip to main content

Posts

Showing posts from October, 2019

A Program to find day by entering date, month and year.

→ A C++ program by me in which you can get the day of any given date. I have written this code by using some mathematical formulas of finding day using a given date, if you find any error or if you want to give me any suggestion then please let me know. #include<iostream> using namespace std; int main() { int date,month,year; int yc,mc,cc,dn,lyc; cout<<"Enter Date, Month and Year to know the Day:"; cin>>date>>month>>year; if(month>12 || date>31) { cout<<"Wrong input"; } else{ //for year int h=year%100; yc=(h+(h/4))%7; //for leap year if(year%4 ==0) { if(year%100 ==0) { if(year%400 == 0) { lyc=1; } } else { lyc=1; } } if(lyc==1) { if(month>2) { lyc=0; } else { lyc=1; } } //for month if(month==01 || month ==10) { mc=0; } else if(month==05) { mc=1; } else if(month==8) { mc=2; } else if(...