Friday, 15 November 2013

Program For Finding DAY For DATE

#include<stdio.h>
#include<conio.h>
void main()
{
int date,month,year,mcode,yel2dg,yef2dg,ycode=6,i,remain;
clrscr();
printf("enter the date(Format:27 02 1991):");
scanf("%d%d%d",&date,&month,&year);
if(month>0&&month<=12)
{
switch(month)
{
case 1:if(date>0&&date<=31)
    {mcode=0;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 2:if(yel2dg%4!=0&&date>0&&date<=28)
    {mcode=3;}
    else if(yel2dg%4==0&&date>0&&date<=29)
    {mcode=3;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 3:if(date>0&&date<=31)
    {mcode=3;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 4:if(date>0&&date<=30)
    {mcode=6;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 5:if(date>0&&date<=31)
    {mcode=1;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 6:if(date>0&&date<=30)
    {mcode=4;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 7:if(date>0&&date<=31)
    {mcode=6;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 8:if(date>0&&date<=31)
    {mcode=2;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 9:if(date>0&&date<=30)
    {mcode=5;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 10:if(date>0&&date<=31)
    {mcode=0;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 11:if(date>0&&date<=30)
    {mcode=3;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
case 12:if(date>0&&date<=31)
    {mcode=5;}
    else
    {printf("Enter The Valid Day");goto end;;}
    break;
}}
else
{printf("Enter The Valid MONTH");goto end;}
yel2dg=year%100;
yef2dg=year/100;
if(yef2dg==0)
{ycode=6;}
else{
for(i=1;i<=yef2dg;i++)
{
if(ycode==0)
{ycode=8;}
 ycode=ycode-2;
}}
remain=(date+yel2dg+(yel2dg/4)+mcode+ycode)%7;
printf("Remainder=%d\n",remain);
if(yel2dg%4==0&&month==1||month==2)
{
switch(remain)
{
case 1:printf("Sunday");break;
case 2:printf("Monday");break;
case 3:printf("Tuesday");break;
case 4:printf("Wednesday");break;
case 5:printf("Thursday");break;
case 6:printf("Friday");break;
case 0:printf("Saturday");break;
}}
else
{
switch(remain)
{
case 0:printf("Sunday");break;
case 1:printf("Monday");break;
case 2:printf("Tuesday");break;
case 3:printf("Wednesday");break;
case 4:printf("Thursday");break;
case 5:printf("Friday");break;
case 6:printf("Saturday");break;
}}
end:
getch();
}



OUTPUT:-
IF U HAVE DOUBT IN THIS:-
Mail Me:manikandang29892@gmail.com

Sunday, 10 November 2013

PROGRAMING FOR FINDING FLAMES

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[20],str2[20],str3[6]={'F','L','A','M','E','S'},temp[1];
int space=0,x=0,k,count1,count2,i,j,shift;
clrscr();
printf("Enter the 1st Name:\n");
gets(str1);
printf("Enter the 2nd Name:\n");
gets(str2);
count1=strlen(str1);
count2=strlen(str2);
for(i=0;i<count1;i++)
{
if(str1[i]==' ')
{space--;
}
}
for(j=0;j<count2;j++)
{
if(str2[j]==' ' && space==0)
{space--;}
else if(str2[j]==' ')
{space++;}
else;
}
start:
for(i=0;i<count1;i++)
{
for(j=0;j<count2;j++)
{
if(str1[i]==str2[j])
{
 for(k=i;k<count1;k++)
 {
 str1[k]=str1[k+1];
 }
 for(k=j;k<count2;k++)
 {
 str2[k]=str2[k+1];
  }
 count1--;
 count2--;
 goto start;
 }}}
 x=count1+count2+space;
 printf("Distinct Characters:%d\n",x);
 for(i=6;i>1;i--)
 {
 shift=x%i;
 for(k=shift;k>=1;k--)
 {
 temp[0]=str3[0];
 for(j=1;j<=i-1;j++)
 {
 str3[j-1]=str3[j];
 }
 str3[i-1]=temp[0];
 }
}
switch(str3[0])
{
case 'F':printf("\nFriend");break;
case 'L':printf("\nLove");break;
case 'A':printf("\nAffection");break;
case 'M':printf("\nMarriage");break;
case 'E':printf("\nEnemy");break;
case 'S':printf("\nSister");break;
}
getch();
}

OUTPUT:-
 IF U HAVE DOUBT IN THIS:-
    Mail Me: manikandang29892@gmail.com