Thursday, 10 December 2020

Write a Program in C++ to accept the number of Days and display the result of after converting it into number of years, number of months and the remaining number of days.

#include <iostream>

using namespace std;

main()

{

  int rem_days,years,months,days;

  cout<<"Enter the Number of Days\n";

  cin>>days;

  years=days/365;

  rem_days=days%365;

  months=rem_days/30;

  days=rem_days%30;

  cout<<"The number of Years: "<<years<<endl;

  cout<<"The number of Months: "<<months<<endl;

  cout<<"The number of Days: "<<days<<endl;

}


No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...