Skip to main content

Posts

Showing posts with the label weeks and days.

ads1

9. Write a C program to convert days into years, weeks and days.

  9. Write a C program to convert days into years, weeks and days.  Solution :-  #include<stdio.h> #include<conio.h> void main() {     clrscr();     int day,year,week,days;     printf("Enter the number of days :- ");     scanf("%d",&days);     year = days/365;     week = (days % 365)/7;     day = days-((year * 365)+(week * 7));     printf("\nThe No. of Year :- %d",year);     printf("\nThe No. of Week:- %d ",week);     printf("\nThe No. of Day :- %d",day); getch(); } Output :-     

Python Basic , 9. Write a Python program to convert days into years, weeks and days.

  9. Write a Python program to convert days into years, weeks and days. Solution :- day = int(input("Enter the days :- ")) year = (day//365) weeks = (day % 365)//7 days = day-((year * 365) + (weeks*7)) print("Year :- ",year) print("weeks :-",weeks) print("Day :-",days) Output :-

JAVA PROGRAM || Write a JAVA program to convert days into years, weeks and days.

                                                                                       Write a Java  program to convert days into years, weeks and days.   (hint)  year = days/365 week = (day % 365)/7) days = days-(year*365)+(weeks*7)) Static :- class YWD {     public static void main(String args[])     {         int day=500;         int year,week,days;         year = (day/365);         week = (day % 365)/7;         days = day-((year*365)+(week*7));         System.out.println("The number of year :- "+year);         System.out.println("The number of week :- "+week);         System.out.println("The number of days :- "+days);     }    } Output :-    Dynamic :- import java.util.*; class YWD {     public static void main(String args[])     {         Scanner in = new Scanner(System.in);         System.out.println("Enter the number of Days :- ");         int day = in.nextInt();         int year,week,days;         year = (day/365);         week = (day % 3

ads2