0
import java.util.*;
class validity
{
public static void main(String args[])throws InputMismatchException
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the date");
int dd=sc.nextInt();
System.out.println("Enter the month");
int mm=sc.nextInt();
System.out.println("Enter the year");
int yyyy=sc.nextInt();
boolean flag=false;
int a,d=365,nod=0,i;
int da[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(dd>0 && dd<=31 && mm>0 && mm<=12)
{
a=yyyy%4;
if ( a==0)
{
da[1]=29;
d=366;
}
flag=true;
}
if (flag==true)
{
System.out.print("Valid Date:");
}
else
System.out.print("Invalid Date");
for(i=0;i<mm-1;i++)
{
nod+=da[i];
}
nod+=dd;
System.out.print(nod);
}
}
class validity
{
public static void main(String args[])throws InputMismatchException
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the date");
int dd=sc.nextInt();
System.out.println("Enter the month");
int mm=sc.nextInt();
System.out.println("Enter the year");
int yyyy=sc.nextInt();
boolean flag=false;
int a,d=365,nod=0,i;
int da[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(dd>0 && dd<=31 && mm>0 && mm<=12)
{
a=yyyy%4;
if ( a==0)
{
da[1]=29;
d=366;
}
flag=true;
}
if (flag==true)
{
System.out.print("Valid Date:");
}
else
System.out.print("Invalid Date");
for(i=0;i<mm-1;i++)
{
nod+=da[i];
}
nod+=dd;
System.out.print(nod);
}
}
PraneetBala
Jan 06, '13
1 answers
0
What errors are you getting in this code? Please mention the error messages, if there is any.
khanmansoor
Jan 14, '13
Log in to your account to answer this questions.