Friday, 22 January 2021

program for class 11th to take days and year and print in full forms like in dd/mm/yyyy

import java.io.*;
class date
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("entre the days between 1 and 366");
        int d=Integer.parseInt(br.readLine());
        System.out.println("entre the year");
        int y=Integer.parseInt(br.readLine());
        String month[]={"january","february","march","aprai","may","june","july","august","september","october","november","december"};
        int year[]={31,28,31,30,31,30,31,31,30,31,30,31};
        if(y%4==0)
        {
            year[1]=29;
        }
        int i=0;
        for(i=0;i<12;i++)
        {
            if(d>=year[i])
            {
                d=d-year[i];
            }
            else
            {
            break;
            }
        }
        System.out.println(d+"/"+month[i]+"/"+y);
    }
}

No comments:

Post a Comment

HAY THAKYOU FOE VISIT

Program(python):-Find duplicates in an array (Geeks for geek problem)

QUESTION:- Given an array  a  of size  N  which contains elements from  0  to  N-1 , you need to find all the elements occurring more than o...