Skip to main content

DAY FINDER

ENTER THE DATE AND SEARCH THE DAY(PAST AND FUTURER)



#include < stdio.h >
#include < conio.h >

  void main() {
    int sd, sm, sy, day, r, y, i, l = 0, sel = 0;
    clrscr();
    printf("first you diside are you find past are future\n");
    printf("press 1 to past\n");
    printf("press 2 to future\n");
    scanf("%d", & sel);
    printf("enter searching date");
    scanf("%d%d%d", & sd, & sm, & sy);
    if (sel == 1) {
      y = 2011 - sy;
      for (i = sy; i <= 2011; i++)
      {
        if (i % 4 != 0)
          continue;
        else
          l++;
      }
    } else {
      y = sy - 2011;
      for (i = 2011; i <= sy; i++)
      {
        if (i % 4 != 0) {
          continue;
        } else {
          l++;
        }
      }
    }
    if (sm == 1) {
      day = sd;
    }
    if (sm == 2) {
      day = sd + 31;
    }
    if (sm == 3) {
      day = sd + 59;
    }
    if (sm == 4) {
      day = sd + 90;
    }
    if (sm == 5) {
      day = sd + 120;
    }
    if (sm == 6) {
      day = sd + 151;
    }
    if (sm == 7) {
      day = sd + 181;
    }
    if (sm == 8) {
      day = sd + 212;
    }
    if (sm == 9) {
      day = sd + 243;
    }
    if (sm == 10) {
      day = sd + 273;
    }
    if (sm == 11) {
      day = sd + 304;

    }
    if (sm == 12) {
      day = sd + 334;
    }
    if (sy < 2011) {
      day = day - y;
      day = day - l;
    }
    if (sy > 2011) {
      day = day + y;
      day = day + l;
    }
    r = day % 7;
    if (r == 1)
      printf("saturday");
    if (r == 2)
      printf("sunday");
    if (r == 3)
      printf("monday");
    if (r == 4)
      printf("tuesday");
    if (r == 5)
      printf("wednesday");
    if (r == 6)
      printf("thursday");
    if (r == 0)
      printf("friday");
    getch();
  }



Comments

Popular posts from this blog

DAY COUNTER

WRITE A PROGRAM TO COUNT YOUR DATE MONTH YEAR IN CURRENT TIME #include<stdio.h> #include<conio.h> void main() { int yy,mm,dd,y,m,d,day,month,year; clrscr(); printf("enter actual date:(dd/mm/yyyy):"); scanf("%d%d%d",&dd,&mm,&yy); printf("enter your date of birth:(dd/mm/yyyy);"); scanf("%d%d%d",&d,&m,&y); if(dd<d) { day=(dd+30)-d; mm=mm-1; } else { day=dd-d; } if(mm<m) { month=(mm+12)-m; yy=yy-1; } else { month=mm-m; } year=yy-y; printf("now you are:%d year%d month%d day:",year,month,day); getch(); }

Kaun Banega Crorepati in c language

                 Welcome to Kaun Banega Crorepati # include <stdio.h> # include <conio.h> #include <graphics.h> #include <stdlib.h> #include"line2.h" int i; char y; void end() { printf("\n You Entered y \n"); printf("\n The program is ending !\n"); printf("\n Thank you for playing\n"); printf("\n Press any key to exit\n"); getch();  } void play() { void q2(); void sound(); printf("\n Your first question is-\n"); printf("\n Which is the capital of Maharashtra?\n"); printf("\n 1) Delhi" "\t" " 2) Mumbai\n"); printf("\n 3) Ranchi" "\t" " 4) Goa \n"); scanf("%d",&i); clrscr(); jeevan(); if(i==2) { printf("\n You win Rs 1000\n"); printf("\n Pres Any key to continue\n"); getch(); printf("\n Do you want to exit? If yes then press y else press other key .\n");...
Android Login View with Video Download Full Source Code