Using while or do-while loop. Make a program that will input birth year. Compute and Display the age of this current year 2021. Your will be terminated if you input zero in the birth year.
#include<iostream>
using namespace std;
int main(){
int birth_year;
do{
cout<<"Enter birth year:\n";
cin>>birth_year;
cout<<"The age is "<<2021- birth_year<<endl;
}while(birth_year !=0);
cout<<"Terminated successfully";
}
Comments
Leave a comment