Computer Science, asked by manjotchhina88, 10 months ago

Write a program that converts number of months into years and months. The user will be asked to enter the number of months. The program should print a message to the user (for example: 16 months are 8equivalent to 1 year(s) and 4 month/s)

Answers

Answered by srajfaroquee
1

Answer:

Note: I am using C++ language.

Code:

#include<iostream>

using namespace std;

int main () {

   int no_of_months  ;

   cout<<"*Enter the number of months : ";

   cin>>no_of_months ;

   int years  = no_of_months /12 ;

   int months = no_of_months % 12 ;

   cout<<"\n " <<years <<" Year(s) and "<<months << " Month(s) ." ;

   return 0 ;

}

**Please follow me and mark this ans as Branliest answer.Thank you!

Similar questions