Written by Saikat :
DIVIDE AND CONQUER ALGORITHM:
The most commonly used & convenient algorithm is the 'Divide & conquer' algorithm. If a problem is tough to solve, then we can assume that this problem is made up by some small problems. Then we can break the main problem in some small sub-problems. Now we can easily solve the sub-problems. By this we can solve the whole problem very easily. This method is called Divide and...
Sunday, 28 July 2013
Thursday, 25 July 2013
Posted by Kousik
This is a program to calculate your
age.
/*AGE CALCULATE*/
#include<stdio.h>
int main()
{
int dd,dm,dy,cd,cm,cy,d,m,y;
printf(“Enter your DATE OF
BIRTH in dd mm yyyy format\n”);
scanf(“%d %d %d”,&dd,&dm,&dy);
printf(“Enter Current Date in
dd mm yyyy format\n”);
scanf(“%d %d %d”,&cd,&cm,&cy);
y=cy-dy;
if(dm>cm)
{
y--;
m=12-(dm-cm);
if(dd>cd)
{
m--;
d=30-(dd-cd);
}
else
{
d=cd-dd;
}
}
else
{
m=cm-dm;
if(dd>cd)
{
m--;
d=30-(dd-cd);
}
else
{
d=cd-dd;
}
printf(“You...
Subscribe to:
Posts (Atom)